egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TCL regexp limitation?

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Fri Aug 28, 2009 9:53 am    Post subject: TCL regexp limitation? Reply with quote

Hey,

Look at this:
Code:
[tomekk@zonk]:/home# php -r 'echo preg_match("/^[a-z]{1,256}$/", "abcd") . "\n";'
1


Code:
[tomekk@zonk]:/home# perl -e 'print "abcd" =~ /[a-z]{1,256}/ . "\n"'
1


tcl:
Code:
[tomekk@zonk]:/home# echo "puts [regexp {^[a-z]{1,256}$} abcd]" | tclsh
couldn't compile regular expression pattern: invalid repetition count(s)


Code:
[tomekk@zonk]:/home# echo "puts [regexp {^[a-z]{1,255}$} abcd]" | tclsh
1


Damn, don't tell me that I have to use [string length] instead of one nice regexp?
Back to top
View user's profile Send private message Visit poster's website
raider2k
Op


Joined: 01 Jan 2008
Posts: 140

PostPosted: Fri Aug 28, 2009 9:58 am    Post subject: Reply with quote

and as far as I know, theres no limitation of regex usage in tcl, havent had any problems at all yet.

//edit:

looks like max specified limit is working with 255 but not with 256 :/
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Fri Aug 28, 2009 10:13 am    Post subject: Reply with quote

yeah, I'm using TCL couple of years, but today is a first day when I used the range {1, 256} and I got this what I wrote above ;]
Back to top
View user's profile Send private message Visit poster's website
raider2k
Op


Joined: 01 Jan 2008
Posts: 140

PostPosted: Fri Aug 28, 2009 10:16 am    Post subject: Reply with quote

found this on the web:

Quote:
RE_DUP_MAX, the limit on repetition counts in bounded repetitions, is 255.


not really making sense if it works in php

... BUT, you are free to use

Code:

puts [regexp {^[a-z]{1,}$} abcd]


which works in my case and limits between 1 and unlimited
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Fri Aug 28, 2009 10:31 am    Post subject: Reply with quote

raider2k wrote:
found this on the web:

Quote:
RE_DUP_MAX, the limit on repetition counts in bounded repetitions, is 255.


not really making sense if it works in php

... BUT, you are free to use

Code:

puts [regexp {^[a-z]{1,}$} abcd]


which works in my case and limits between 1 and unlimited


hehe, I know about that,
but I need to set a range,
otherwise its funny thing with that Smile

without proper regexp I have to use extra [string length]
Back to top
View user's profile Send private message Visit poster's website
raider2k
Op


Joined: 01 Jan 2008
Posts: 140

PostPosted: Fri Aug 28, 2009 10:38 am    Post subject: Reply with quote

how about exec yourscript.php $var?

and besides that, I would wait for nml or someone else who might be knowing about such "issues" - I dont use limiters very often
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Fri Aug 28, 2009 10:40 am    Post subject: Reply with quote

raider2k wrote:
how about exec yourscript.php $var?


oh no way, it's stupid ;p
Back to top
View user's profile Send private message Visit poster's website
raider2k
Op


Joined: 01 Jan 2008
Posts: 140

PostPosted: Fri Aug 28, 2009 10:45 am    Post subject: Reply with quote

lol
but its a much better solution than using more code, at least in my humbly opinion Razz
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Fri Aug 28, 2009 10:55 am    Post subject: Reply with quote

I can always use couple of ranges, I mean (512 chars):
Code:
[tomekk@zonk]:/home# echo "puts [regexp {^[a-z]{1,255}[a-z]{0,255}[a-z]{0,2}$} "<512 a chars in here>" ]" | tclsh
1


but this limitation is still funny Wink
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber