From: Pierre-Alexandre V. <ont...@gm...> - 2012-01-27 09:54:32
|
All my bad, i misread documentation. Could i recommend to change regexp_string to regexp_exact_string to avoid confusing ? 2012/1/27 Pierre-Alexandre Voye <ont...@gm...> > Hello, I have a problem with a PCRE regexp using Netstring_pcre module : > My regexp ( "\s.*" ) works with perl : > perl -e ' $s = "5bcb43b5f2d12bfc39cdd4dc1a4c3757b3129bc0 > /tmp/UserLs_j.ml"; $s=~s/\s.*//g; print $s;' > *i get : 5bcb43b5f2d12bfc39cdd4dc1a4c3757b3129bc0* > > But if i try : > Netstring_pcre.global_replace (Netstring_pcre.regexp_string "\\s.*") "" > "5bcb43b5f2d12bfc39cdd4dc1a4c3757b3129bc0 /tmp/UserLs_j.ml";; > - : string = "5bcb43b5f2d12bfc39cdd4dc1a4c3757b3129bc0 /tmp/UserLs_j.ml" > > > Other problem : > Netstring_pcre.global_replace (Netstring_pcre.regexp_string > "^([a-f0-9]+)\\s.*") "\\1" "5bcb43b5f2d12bfc39cdd4dc1a4c3757b3129bc0 > /tmp/UserLs_j.ml";; > > Exception: > > Failure "Pcre.replace: backreference denotes nonexistent subpattern". > > > Regards, > > Pierre-Alexandre > > -- > --------------------- > https://twitter.com/#!/ontologiae/ > http://linuxfr.org/users/montaigne > > -- --------------------- https://twitter.com/#!/ontologiae/ http://linuxfr.org/users/montaigne |