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.
Old posts that have not been replied to for several years.
ex
Voice
Posts: 14 Joined: Wed May 18, 2005 11:04 pm
Location: Chicago
Post
by ex » Wed May 18, 2005 11:09 pm
hi i'm having a problem with regex
Code: Select all
return [regexp "^.*test(.+?)test.*" "testlalatest"]
returns 1.
so far so good.
but if i extend the string an the matchstring it is not working anymore.
Code: Select all
#normally the code is in one line - but it's much more easy to read now :)#
return [regexp
"^.*<td><a class=\"orangelink\" href=\"/news/showdetail.aspx?news_id=1\">test(.+?)test.*"
"<td><a class=\"orangelink\" href=\"/news/showdetail.aspx?news_id=1\">testlalatest"
]
as you can see ... i just added sume htmlstuff in the front. but suddenly it returns 0
is there a limit of the stringlength or did i something wrong?
De Kus
Revered One
Posts: 1361 Joined: Sun Dec 15, 2002 11:41 am
Location: Germany
Post
by De Kus » Thu May 19, 2005 3:41 am
you forgot to escape "?" in the html code. btw. you should use {} braces around the re expressions, this makes even the escaping of the " quotes redudant
.
besides... whats the meaning of "?" in "(.+?)"?
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under
The MIT License
Love hurts, love strengthens...
greenbear
Owner
Posts: 733 Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway
Post
by greenbear » Thu May 19, 2005 10:32 am
the ? it makes it stop after the first match.
ex
Voice
Posts: 14 Joined: Wed May 18, 2005 11:04 pm
Location: Chicago
Post
by ex » Thu May 19, 2005 10:39 am
argh. damn must have overseen it in the manual.
grml then it is quite clear why i tried 4 hours with no result.
ex
Voice
Posts: 14 Joined: Wed May 18, 2005 11:04 pm
Location: Chicago
Post
by ex » Thu May 19, 2005 2:21 pm
Code: Select all
return [regexp
{</tt>: <a class="link" href="http://www.eggheads.org/redirect.php?url=(.+)">(.+)</a>}
{004 ]</tt>: <a class="link" href="http://www.eggheads.org/redirect.php?url=http://www.eggheads.org/news/2004/08/23/31">Eggdrop 1.6.17 released</a><br}
tmp url news];
ok i changed it. but still it returns 0 after entering long strings.
the following works fine:
Code: Select all
return [regexp {lala(.+)la(.+)a} {lala123lala}]
ex
Voice
Posts: 14 Joined: Wed May 18, 2005 11:04 pm
Location: Chicago
Post
by ex » Thu May 19, 2005 2:33 pm
solved.
the { } still needs the escape of ?
i missunderstood this.
thank you all