Re: search for exact number



bill lam wrote:
On Mon, 12 Jan 2009, Morten Welinder wrote:
  
In the meantime, searching for "^123$" as a regular expression
(on the Advanced page) and not searching in strings, is a pretty
good  substitute.
    

Thanks, This works very well except it depends on number format, eg
only 1,234 (but not 1234) will match 1,234,  I can live with it.
  

If it follows the extended rules of regular expressions, then I think
"^1,*234$" should work.  If that doesn't work though, try "^1[,]*234$". 
(Some characters have to be "escaped", and escaping can vary.  Putting
the item within braces can circumvent the escaping issue in many cases. 
(If the first item in a list inside braces is the caret, the remaining
characters in the list become a list of things NOT to match.)  Using
"^1[.,]*234$" would match 1,234 or 1.234 or even 1,,.,...,,234 .  If
outside the braces, a period in regular expressions match ANY character
unless escaped.  The asterisk says to match the character (or list of
characters within braces) before the asterisk zero-or-more times.) 
Those who know regex (regular expressions) better than I do will no
doubt correct anything I got wrong.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]