Matching sentence between two strings

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
lightInt
Forum Newbie
Posts: 2
Joined: Thu Aug 28, 2008 4:58 am

Matching sentence between two strings

Post by lightInt »

Hi,

I am trying to create a regex that will match a sentence between two specific strings.
below is the sentence to match, the part I would like to match is marked in bold.

[[Text:hi this is a nice sentence[[very nice]] I like this text]] this is not related [[not]]

I have the following regex: \[\[Text:.*?]]
The problem is that it stops at the ]] after "very nice" and matches only: [[Text:hi this is a nice sentence[[very nice]]

Thanks anyone for any help.

Light Interactive.
User avatar
prometheuzz
Forum Regular
Posts: 779
Joined: Fri Apr 04, 2008 5:51 am

Re: Matching sentence between two strings

Post by prometheuzz »

When after some time you're not being answered in one place, I can imagine posting somewhere else. You however, cross posted this almost at the same time in at least one other forum, which is rather rude: people here could be wasting their time by answering you because you are already answered somewhere else:

http://regexadvice.com/forums/thread/45732.aspx
lightInt
Forum Newbie
Posts: 2
Joined: Thu Aug 28, 2008 4:58 am

Re: Matching sentence between two strings

Post by lightInt »

Problem solved. Thanks.
User avatar
prometheuzz
Forum Regular
Posts: 779
Joined: Fri Apr 04, 2008 5:51 am

Re: Matching sentence between two strings

Post by prometheuzz »

lightInt wrote:Problem solved. Thanks.
Yes, I saw that. Next time, please provide a link to the other forum(s) you posted your question: people can then first check to see if you've been answered elsewhere before spending time on your question.
Post Reply