Re: Really PCRE regexp ?
Pierre-Alexandre Voye <[email protected]> Fri, 27 Jan 2012 10:54:00 +0100
| Newsgroups | gmane.comp.lang.ocaml.lib.net.devel |
|---|---|
| Message-ID | <CANnJ5Gd3BYPAVMZDUzdjZfQmU+T7sSyws2Chwb2-FL2AOnN3Uw@mail.gmail.com> |
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 <[email protected]> > 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 ------------------------------------------------------------------------------ Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2 _______________________________________________ Ocamlnet-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ocamlnet-devel