Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Regex challenge !

Status
Not open for further replies.

Badgers

Programmer
Nov 20, 2001
187
US
Hi,

Any regex experts out there, been working on this, but wondering if anyone has idea to creating this...

A string value and return a boolean indicating if the string matches the pattern

The input can consist of the following values: a-z, \, _, %.

_ in the pattern represents any character
% represents 0 or more characters
\ can be used to escape the next character to take away any special meaning.


For example, patterns :
“a_c” matches “abc” but not “abcd”
“ab%d” matches “abdgdgdgd” or “abd” but not “abbbde”
“ab\%” matches “ab%” but not “abcd”
“__%” matches “ab” and “abcd” but not “a”

Thanks
 
“ab%d” matches “abdgdgdgd” or “abd” but not “abbbde”

% is '0 or more' characters but your example points to % indicating 1 or more characters exluding 1 or more of the SAME character.


Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top