putting comments into regex strings

Tips on writing regular expressions for searching the post list

Moderators: Quade, dexter

putting comments into regex strings

Postby bobkoure » Fri Jul 13, 2007 2:39 pm

The regex engine NBP uses appears to understand regex comments just fine.
These look like (?#all this is a comment)
This might be useful if you keep a text file of useful regex strings as you can keep the "what it does" explanation right in the string itself - and, if you put this comment at the beginning of the line it will show up in the "past strings used" in the drop-down window - so for example:

(?#hide pdb and lib)^(?!.*pdb)(?!.*lib)
bobkoure
 

Postby Smite » Fri Jul 13, 2007 7:01 pm

Cool idea. Thanks.
Please read the FAQ before asking any questions.
If you're new to newsgroups, and the files on them, you can find a very helpful guide here.
User avatar
Smite
Katamari Damacy Addict
 
Posts: 5318
Joined: Sat May 19, 2001 1:54 am
Location: Alberta, Canada

Registered Newsbin User since: 03/27/03

Postby bobkoure » Fri Sep 28, 2007 8:51 am

Lately, I've been finding comments more useful in filters - lots easier to read a comment than re-figure-out what the filter does.
bobkoure
 


Return to Regular Expressions

Who is online

Users browsing this forum: No registered users and 2 guests