There may or maynot be a sub-pattern in the pattern
Posted: Thu Jul 14, 2005 12:52 pm
I have a pattern say
How do I make it in such a way that there may or maynot be a sub-pattern in the middle ?
The string can be:
The result I need is
aaa1123445556ccc for str1 and
aaa1123ddd6774aaa4232ccc4545eee445556ccc for str2. ?
Thanks
Code: Select all
/aaa(.*?)ccc/isThe string can be:
Code: Select all
str1 = "e;xxxaaa1123445556cccxxx"e;;
str2 = "e;xxxaaa1123ddd6774aaa4232ccc4545eee445556cccxxx"e;;aaa1123445556ccc for str1 and
aaa1123ddd6774aaa4232ccc4545eee445556ccc for str2.
Code: Select all
/aaa(.*?їddd.*?eee]+.*?)ccc/isThanks