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

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -