Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TODO: Escape characters in patterns #1

Open
cypreess opened this issue Jun 26, 2013 · 4 comments
Open

TODO: Escape characters in patterns #1

cypreess opened this issue Jun 26, 2013 · 4 comments
Labels

Comments

@cypreess
Copy link
Owner

No description provided.

@toutouastro
Copy link

explain ?

@cypreess
Copy link
Owner Author

rex parses it's input to match something like [m|s]<delimiter>pattern<delimiter>substituion<delimiter>[flags]. eg.

s/dog/cat/i

Matching is VERY trivial and it will not work if you use delimiter character inside of the pattern, e.g.: substitution of all http: to http://

s/http:/http:/// usually you should write it like s/http:/http:\/\// - but none of those two ways will work right now.

However it can be easily solved by using other delimiter:

s!http:!http://!

The only thing is you are not allowed to use delimiter character inside pattern right now.

@toutouastro
Copy link

so you should give the user the option to modify the delimiter character ?

@cypreess
Copy link
Owner Author

It's already there. The same as in perl you can write s/dog/cat/ or s?dog?cat? or whatever s!dog!cat!. rex automatically detects what is the delimiter sign. Check the source code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants