I want to match all valid prefixes with the other characters with the option
, so that
Options / ABC / DF
- Match ABC / DEF
Options
. - The
subt / abc / def
match does not match or only matches thesub
section, nott
.
My current reggae is / ^ s (u (b (s (t (u (te?)?))?)?)?)?)?)? )?)? /
, which works, though it seems a little verbose.
Is there any better (less, verbose) to do this?
You can use two-step reggae
- Use the simple pattern to find the first word of the subject
^ (\ w +)
- Use the word extracted from step 1 as if your regex pattern is the word
option
^ subs
against
No comments:
Post a Comment