matchText & Regex help!

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
ARAS
Posts: 55
Joined: Sat Nov 02, 2013 5:35 pm
Location: Turkey

matchText & Regex help!

Post by ARAS » Wed Dec 24, 2014 8:29 pm

Hello all,

I need some help. I need to get the number which is after "id_no=" in a field.

I have tried to get it with the code below but the answer box is always empty. It doesn't return the value. Is there a way to return the value that matches with regex? For example, 21234 from the link below.

Inside the field
http://www.abcdef.com/odc/eds.asp?id_no=21234

Code

Code: Select all

answer funwithRegex("id_no=[0-9]*")

Code: Select all

function funwithRegex theName
   if matchText( field "Field", theName, theValue) then
      return theValue
   else
      return "not found"
   end if
end funwithRegex
Thanks for the help.

phaworth
Posts: 592
Joined: Thu Jun 11, 2009 9:51 pm

Re: matchText & Regex help!

Post by phaworth » Fri Dec 26, 2014 1:08 am

You need some "capturing parentheses" in your regex. Right now the regex matches but there's nothing for it to return to you. Try:

id_no=([0-9]*)

Pete

ARAS
Posts: 55
Joined: Sat Nov 02, 2013 5:35 pm
Location: Turkey

Re: matchText & Regex help!

Post by ARAS » Fri Dec 26, 2014 7:14 pm

Thanks Pete! It works!

Post Reply

Return to “Internet”