Need Regex for to match special situations
- by Daniel
I'm desperately searching for regular expressions that match these scenarios:
1) Match alternating chars
I've a string like "This is my foobababababaf string" - and I want to match "babababa"
Only thing I know is the length of the fragment to search - I don't know what chars/digits that might be - but they are alternating.
I've really no clue where to start :(
2) Match combined groups
In a string like "This is my foobaafoobaaaooo string" - and I want to match "aaaooo". Like in 1) I don't know what chars/digits that might be. I only know that they will appear in two groups.
I experimented using (.)\1\1\1(.)\1\1\1 and things like this...