| View previous topic :: View next topic |
| Author |
Message |
tomekk Master

Joined: 28 Nov 2008 Posts: 255 Location: Oswiecim / Poland
|
Posted: Fri Aug 28, 2009 9:53 am Post subject: TCL regexp limitation? |
|
|
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 |
|
 |
raider2k Op
Joined: 01 Jan 2008 Posts: 140
|
Posted: Fri Aug 28, 2009 9:58 am Post subject: |
|
|
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 |
|
 |
tomekk Master

Joined: 28 Nov 2008 Posts: 255 Location: Oswiecim / Poland
|
Posted: Fri Aug 28, 2009 10:13 am Post subject: |
|
|
| 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 |
|
 |
raider2k Op
Joined: 01 Jan 2008 Posts: 140
|
Posted: Fri Aug 28, 2009 10:16 am Post subject: |
|
|
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 |
|
 |
tomekk Master

Joined: 28 Nov 2008 Posts: 255 Location: Oswiecim / Poland
|
Posted: Fri Aug 28, 2009 10:31 am Post subject: |
|
|
| 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
without proper regexp I have to use extra [string length] |
|
| Back to top |
|
 |
raider2k Op
Joined: 01 Jan 2008 Posts: 140
|
Posted: Fri Aug 28, 2009 10:38 am Post subject: |
|
|
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 |
|
 |
tomekk Master

Joined: 28 Nov 2008 Posts: 255 Location: Oswiecim / Poland
|
Posted: Fri Aug 28, 2009 10:40 am Post subject: |
|
|
| raider2k wrote: | how about exec yourscript.php $var?
|
oh no way, it's stupid ;p |
|
| Back to top |
|
 |
raider2k Op
Joined: 01 Jan 2008 Posts: 140
|
Posted: Fri Aug 28, 2009 10:45 am Post subject: |
|
|
lol
but its a much better solution than using more code, at least in my humbly opinion  |
|
| Back to top |
|
 |
tomekk Master

Joined: 28 Nov 2008 Posts: 255 Location: Oswiecim / Poland
|
Posted: Fri Aug 28, 2009 10:55 am Post subject: |
|
|
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  |
|
| Back to top |
|
 |
|