regex - Regular expression to match strings composed of ABAs or ABs -
i want write regular expression match strings composed of abas or of abs. here's regular expression right now:
(aba)+|(ab)+
i want match:
ab aba abab abaaba ababab
but present regular expression not match abab.
if change (ab)+|(aba)+ not match aba.
how can write regular expression want?
what want regular expression matching "the longest substring matching (ab)+ or (aba)+".
you can try either /(aba?)+/gm
- should give need.
Comments
Post a Comment