This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

regexp problem..

Help for those learning Tcl or writing their own scripts.
Post Reply
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

regexp problem..

Post by Ofloo »

i've got this issue with html tags, .. for some reason

this can be <div id="building_contract2"> or <div id="building_contract">

Code: Select all

regexp -nocase {<div id="building_contract"><div class="f10 b">.+?</div>(.+?)</div>} $data > build
works

Code: Select all

regexp -nocase {<div id="building_contract2"><div class="f10 b">.+?</div>(.+?)</div>} $data  > build
works

Code: Select all

regexp -nocase {<div id="building_contract[0-9]{0,1}"><div class="f10 b">.+?</div>(.+?)</div>} $data > build
doesn't work ..

why is that?
XplaiN but think of me as stupid
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Just tested with some trivial data, and works just fine for me. You are using non-greedy quantifiers, so I can't see no good reason for the third one failing.

Could you post some real data that works/doesn't work?
NML_375
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

it is kindoff a lot .. it's whole html page .. i did some tests to .. on emulated tests it works just fine however on a site it doesn't maybe i'm nto considering all special charaters,.. and should split the data before i regexp it .. i'll let you know how it turns out.
XplaiN but think of me as stupid
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Ofloo wrote:it is kindoff a lot .. it's whole html page .. i did some tests to .. on emulated tests it works just fine however on a site it doesn't maybe i'm nto considering all special charaters,.. and should split the data before i regexp it .. i'll let you know how it turns out.
This is why Webby was created. You can test/debug regular expressions on a webpage in real time with a pretty standard simple interface. This should help you debug the problem.
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

it's an page which requires authentication.. but it seems a nice script i often do this from console ..

ctrl u copy paste set data {htmlpage} then test my regexp

EDIT: And it seems to work in real time .. to figur..
XplaiN but think of me as stupid
Post Reply