www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - regex escapes

reply spir <denis.spir gmail.com> writes:
Hello,

Which characters are to be escaped:
* inside [] classes
* outside such classes
?

Also, is there for D regexes a "free form" format (where whitespace can be used 
to present formats more legibly, but must be escaped as literals)?

Denis
-- 
_________________
vita es estrany
spir.wikidot.com
Feb 16 2011
next sibling parent Alex Folland <lexlexlex gmail.com> writes:
On 2011-02-16 5:48, spir wrote:
 Hello,

 Which characters are to be escaped:
 * inside [] classes
 * outside such classes
 ?

 Also, is there for D regexes a "free form" format (where whitespace can
 be used to present formats more legibly, but must be escaped as literals)?

 Denis
This is a comment in a regular expression: (?#comment) The text, "comment", can be replaced with anything including whitespace. The comment is terminated with ). Oh, never mind. I just tested this. std.regex doesn't support regex comments, apparently. :(
Feb 16 2011
prev sibling parent Jesse Phillips <jessekphillips+D gmail.com> writes:
spir Wrote:

 Hello,
 
 Which characters are to be escaped:
 * inside [] classes
 * outside such classes
 ?
 
 Also, is there for D regexes a "free form" format (where whitespace can be
used 
 to present formats more legibly, but must be escaped as literals)?
Though you are probably asking specifically about D: http://www.regular-expressions.info/charclass.html std.regex doesn't follow everything so testing usually must be done with D. There is no place to find what isn't supported by D. Filing bugs is of course a good choice.
Feb 16 2011