Re: [PHP] Regexp help (simple)

2004-01-22 Thread Dagfinn Reiersl
Victor Spng Arthursson wrote: Have been playing around a bit with this code, but I can't get it to work with international characters For example, if I feed my function: function split_bokid($bokid) { if (preg_match('/^([a-z]{2,3})([0-9]{4,5}(\-[0-9]{1,2}){0,1})$/

Re: [PHP] Regexp help (simple)

2004-01-22 Thread Victor Spång Arthursson
2004-01-22 kl. 10.40 skrev Dagfinn Reiersl: I assume you mean: $test = split_bokid(12345); Yes! I don't know. It works fine on my computer. The letters display correctly on the command line and even in Mozilla. Hmmm try the following:

Re: [PHP] Regexp help (simple)

2004-01-22 Thread Martin Luethi
maybe this work: replace the special-characters first, eg.: $bokid = str_replace(å, _, $bokid); and replace them back after preg_match or try the preg_match with the hexcode of this special chars: \xhh character with hex code hh (http://ch2.php.net/manual/de/pcre.pattern.syntax.php) g. martin

Re: [PHP] Regexp help (simple)

2004-01-21 Thread Victor Spång Arthursson
2004-01-20 kl. 10.41 skrev Dagfinn Reiersl: [EMAIL PROTECTED] wrote: $string = 'ab12345-1'; if (preg_match('/^([a-z]{2,3})([0-9]{4,5}(\-[0-9]{1,2}){0,1})$/i', $string, $m='')) { echo $m[1]; // - ab echo $m[2]; // - 12345-1 } g. martin luethi You can replace {0,1} with a question mark and

[PHP] Regexp help (simple)

2004-01-20 Thread Victor Spång Arthursson
Hi! Anyone who could help me with this regexp problem? I want to verify that a string is made up of 2-3 letters, (a-z + åäö, A-Z + ÅÖÄ), directly followed by 4 or 5 digits, which could, but may not, be followed by a minus and one or two digits. Examples of valid strings: abc12345 ABC12345

Re: [PHP] Regexp help (simple)

2004-01-20 Thread php
$string = 'ab12345-1'; if (preg_match('/^([a-zåäö]{2,3})([0-9]{4,5}(\-[0-9]{1,2}){0,1})$/i', $string, $m='')) { echo $m[1]; // - ab echo $m[2]; // - 12345-1 } g. martin luethi Tue, 20 Jan 2004 09:59:37 +0100 Victor Spång Arthursson [EMAIL PROTECTED]: Hi! Anyone who could help me with

Re: [PHP] Regexp help (simple)

2004-01-20 Thread Dagfinn Reiersøl
[EMAIL PROTECTED] wrote: $string = 'ab12345-1'; if (preg_match('/^([a-zåäö]{2,3})([0-9]{4,5}(\-[0-9]{1,2}){0,1})$/i', $string, $m='')) { echo $m[1]; // - ab echo $m[2]; // - 12345-1 } g. martin luethi You can replace {0,1} with a question mark and [0-9] with \d (digit). Also, and I think