mIRC Homepage
Posted By: s0tt0 little regex help - 01/02/07 09:01 AM
I want to get certain string(word) between characters '>' and ':'. How can I strip it out?

Example: some bot says in the channel
"<botname> <COOLCHAN> someone: blablabla"
How can I strip the "someone" string from there (it is between '>' and ':' marks)?
Posted By: Thrull Re: little regex help - 01/02/07 10:58 AM
/noop $regex(text,/>([a-z]*)\:/i)

That will store (capture) the text in $regml. Your example shows a space after '>' which will change it to

/noop $regex(text,/>\s([a-z]*)\:/i)

Btw, if you need more help feel free to drop by #Regex on Undernet. There's almost always someone around to help out with simple stuff.
Posted By: s0tt0 Re: little regex help - 01/02/07 11:12 AM
thank you so very much!
Posted By: s0tt0 Re: little regex help - 01/02/07 11:32 AM
Originally Posted By: Thrull
/noop $regex(text,/>([a-z]*)\:/i)

That will store (capture) the text in $regml. Your example shows a space after '>' which will change it to

/noop $regex(text,/>\s([a-z]*)\:/i)

Btw, if you need more help feel free to drop by #Regex on Undernet. There's almost always someone around to help out with simple stuff.

you were right that i had space after the > sign, but the string what comes after that can contain spaces too but it should captur those with it.
like:
<BLA> this is sentence with spaces: oirj ojfojeqofjweoifj

it should capture the whole sentence now like this:
"this is sentence with spaces"

Oh and the sentence can contain ANY characters (except ':')
Posted By: s0tt0 Re: little regex help - 01/02/07 12:02 PM
ok i got it already thanks again! laugh
for those who want this kind of thing

$regex(sentencetobechecked,>(.*?):)
© mIRC Discussion Forums