...

View Full Version : Help with regex plz... :(



jaywhy13
08-12-2005, 03:10 PM
I have the following regex that will match any number from 1-999. Here it is:
"([1-9]\d{0,2})(?!-| -|\d-|\d -)"
I need to add to the front.. there should be NO greater than or less than signs or dashes at the start of the string. The only thing allowed at the start of the string is a space or it can be the first character in the string. Please help.
The second submatch simply looks ahead to make sure that no dashes are found trailing after the match.

miranda
08-12-2005, 06:20 PM
using this at the beginning of your regex ^\s? will allow a space at the beginning of the string

jaywhy13
08-12-2005, 11:39 PM
using this at the beginning of your regex ^\s? will allow a space at the beginning of the string

I see that... but the thing is.. the number can appear anywhere in the string. Cannot use ^ right there So its like, the rule that I want is... There should not be either of these to the right or left of the number... <,>,- none.. space is permitted but not any of those characters...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum