RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find command line option no duplicate
Expression
\s*((a|b|c)\s+(?!.*\2.*))*(a|b|c)\s*
Description
suppose you have a exe/command take options like "a b c" or "b c a", the sequence doesn't matter, but on option should only appear at most once. The ?! is "negative look ahead", \2 refer the second group.
Matches
"b c a", " a c b ", "a b c "
Non-Matches
"a b c a", "b c a c", "a b c d", "ab c "
Author Rating: Not yet rated. Wang , Feng
Source
Your Rating
Bad Good

Enter New Comment

Title
 
Name
 
Comment
 
Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Copyright © 2001-2018, RegexAdvice.com | ASP.NET Tutorials