I request for your assistance for the following problem.
You can a formulate the following in a regular expression.
The RE should match, when bbbddd follows directly aaa. (in which dfsdfs.. is a substitute for any character and the rest is also simplfied)
> Is aaa.*?(?!bbb(?!ddd))bbbddd the same?
Not.
Let's take aaaXYZbbbddd as example.
The 'aaa' part in the RE matches the 'aaa' in the target. Then the '.*?' goes: 'X' -ok, 'Y' -ok, 'Z' -not ok, quite because of the '(?!bbb(?!ddd))' !!!
I.e. there is a an inherent contradiction within the pattern.
Hope this helps.
BTW, I very recommend to use the "Monitor this forum" feature in sourceforge forums. It's convenient and safe (your email wouldn't be revealed to anyone, including the owner) and doesn't reqire registration.
Regards
PS The question was very interesting.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I request for your assistance for the following problem.
You can a formulate the following in a regular expression.
The RE should match, when bbbddd follows directly aaa. (in which dfsdfs.. is a substitute for any character and the rest is also simplfied)
aaa
dfsdfsdfsd
bbbddd
dfsdfsdfsd
bbb
dfsdfsdfsd
bbbccc
The RE should not match with the following example
aaa
dfsdfsdfsd
bbbccc
dfsdfsdfsd
bbb
dfsdfsdfsd
bbbddd
I tried it with assertions und condition, but i did not find a solution. i.g: aaa.*?(?=bbb)bbbddd
Please help me.
jr-ramses@gmx.net
> The RE should match, when bbbddd follows directly aaa.
Sounds easy: "aaabbbddd" :)
Seem to catch it: you possibly mean "from 'aaa' to 'bbbddd' without 'bbb' in between",right?
Not so easy... May be so:
(?s)aaa(?:.(?!bbb(?!ddd)))*?bbbddd
At least it works with your exapmles.
Thats it. You are great!!!
Thank you very much.
Only some additional questions.
Why do i need this non capturing group?
Is aaa.*?(?!bbb(?!ddd))bbbddd the same?
> Is aaa.*?(?!bbb(?!ddd))bbbddd the same?
Not.
Let's take aaaXYZbbbddd as example.
The 'aaa' part in the RE matches the 'aaa' in the target. Then the '.*?' goes: 'X' -ok, 'Y' -ok, 'Z' -not ok, quite because of the '(?!bbb(?!ddd))' !!!
I.e. there is a an inherent contradiction within the pattern.
Hope this helps.
BTW, I very recommend to use the "Monitor this forum" feature in sourceforge forums. It's convenient and safe (your email wouldn't be revealed to anyone, including the owner) and doesn't reqire registration.
Regards
PS The question was very interesting.