0

I have a string like this :

[01/09/2015 00:00:47]       INFO=54646486432154646 from=steve   idfrom=55516654455457       to=jone       idto=5552045646464 guid=100021623456461451463   n
um=6    text=hi my number is 0 811 22 1/12   status=new      survstatus=new

I want to extract the text field, the result should like this :

hi my number is 0 811 22 1/12

This is what I tried as regex :

text=(.*)status

And it gives me this :

hi my number is 0 811 22 1/12   status=new      survstatus=new

So it's not what I want, how can I get rid of two last fields?

Thanks.

3

3 Answers 3

1

I'd use:

\btext=(.*?)\bstatus=

in order avoid matching status in hi my status is 0

Sign up to request clarification or add additional context in comments.

Comments

0

So the answer is text=(.*?)status, thank @HamZa for the quick answer.

Comments

0

It looks like your data is tab-delimited. If that is the case, this is probably better:

\ttext=([^\t*])

Which basically says, find a tab followed by 'text=' and then capture everything up until the next tab.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.