Talk:Regular expression syntax

From EditPlus Wiki
Jump to: navigation, search

There seems to be a bug in editplus with newline characters, even after installing the current patch.

IE: This regular expression <tag>.*\n.*</tag>

Matches the following text:


<tag>


</tag>


When I think it should only match a single newline inside the tag. Can anyone else duplicate this, or correct me if I'm mistaken?

Thanks,

Jared jared AT blatantcreative DOT com

[EDIT: This seems to be true in html files but not text files. I havent tried others.]

Matching "(" and ")" in regular expressions

How does one do a literal match on characters used as regular expression operators? An real-world example: I have a list of email addresses and names that I want to strip the names out of and they are in the following format:

Bob Smith (bob.smith@domain.com)

And I want to extract:

bob.smith@domain.com

The thing I couldn't work out how to do was match the "(" and ")" characters so I could pull out the data between them, as the parentheses characters would get interpreted as regex operators. I think it would be worth noting in this section how to escape the operator characters ("\" is described, from which I would infer that the others are probably escaped in the same way - e.g. "\.", "\(" etc, but it would probably be worth noting the correct way to do this).

- Bevan.