AW: How trim: Bug in RegExp engine

Marielle Lange mlange at lexicall.org
Tue Oct 25 18:15:46 EDT 2005


> So AFAICT we have a full and complete PCRE implementation here,  
> with no
> 'real' bugs associated with it.

I fully agree on the full and complete PCRE. Now I know it is there,  
I tested it and all the syntactic variations I know about are there.

But how do I need to call this if not a bug?

put "_" & replacetext("A C", "^ *", "")    -> _C
put "_" & replacetext("A C", "^", "")      -> _

I tested it in BBEdit and PHP, I don't get these very strange  
results. At the page: http://revolution.lexicall.org/regexp_test.php,  
you see the result of the following php instructions:

     $ttext = "A C" ;
     $ttext = preg_replace('/^ */', '', $ttext);
     echo "_" . $ttext . "<br />";          --> _A C

     $ttext = " A C";
     $ttext = preg_replace('/^ */', '', $ttext);
     echo "_" . $ttext . "<br />";           --> _A C

     $ttext = " A C";
     $ttext = preg_replace('/^/', '', $ttext);
     echo "_" . $ttext . "<br />";           --> _ A C

     $ttext = "A C";
     $ttext = preg_replace('/^/', '', $ttext);
     echo "_" . $ttext . "<br />";          -->    _A C

Cheers,
Marielle


------------------------------------------------------------------------ 
--------
Marielle Lange (PhD),  Psycholinguist

Alternative emails: mlange at blueyonder.co.uk, M.Lange at ed.ac.uk
Homepage                                                            
http://homepages.lexicall.org/mlange/
Easy access to lexical databases                    http://lexicall.org
Supporting Education Technologists              http:// 
revolution.lexicall.org





More information about the use-livecode mailing list