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

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 1
Title Test Details 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
   Displaying page 1 of 1 pages; Items 1 to 1

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