[ALUG] Are there any Regular Expression gurus here?

Steve Engledow steve at offend.me.uk
Mon Oct 30 09:26:33 GMT 2017


>-------- Original Message --------
>The first line is essentially random, the second line will be all the
> same character of a limited number of possibles (=, - and maybe a
> couple more). The lines can probably be required to be the same length
> but it would be nice if they didn't have to be. It would be OK to have
> multiple REs, one for each possible 'underline' character.

Context is everything. Why are you trying to do this with a regular expression and what implementation will you be using?

Something like /([-_=])\1{3,}/ will match the underline part (the rest is straightforward) in some implementations but not all allow you to use backrefs in the match.

/.{4,}\n([-_=])\1{3,}/ ought to match what you've described. Again... it depends ;)

Steve


More information about the main mailing list