samsouder / reggy

Objective-C interactive regular expression validator and tester for OS X.
http://reggyapp.com
356 stars 24 forks source link

escaping parenthesis #19

Open jimmedlen opened 11 years ago

jimmedlen commented 11 years ago

^.mail exchanger = [0-9] (.).$ In Reggy it appears that I have to escape the parenthesis in order to define a sub pattern. I do not have to do this when using the same regex to search by grep with BBEdit or Preg Match. I thought it was the opposite that parenthesis had to be escaped to be considered as part of the string. Is this a bug or am I missing something with how to define sub patterns?

samsouder commented 11 years ago

Hmm, I am not sure what your test string is, but I think you may be trying to capture 'testing' in the testing string 'blah mail exchanger = 13 testing'. If that is the case, you need to modify your pattern a bit to look like this: ^.mail exchanger = [0-9] (.+)$ Basically it looks like you were only trying to capture one character that was second from the last character.

What do you think? If that doesn't make sense, just post me your testing string and what you are trying to capture and I'll do my best to help you out.