"ocaml_beginners"::[] Str vs Pcre

View: New views
2 Messages — Rating Filter:   Alert me  

"ocaml_beginners"::[] Str vs Pcre

by Rakotomandimby Mihamina-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello
I made a simple CGI script, with some forms.
I would like to
- remove bad chars from input strings.
- trim input strings (remove spaces, tabs, newlines,...)

I would like to make some simple replace with simple regexes.
I saw Str regexes use is simpler (to me) and Pcre probably more powerfull
but not yet caught (by me).

What would you recommend?

--
       Architecte Informatique chez Blueline/Gulfsat:
    Administration Systeme, Recherche & Developpement
                                    +261 34 29 155 34

Re: "ocaml_beginners"::[] Str vs Pcre

by Richard Jones-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Oct 15, 2009 at 05:03:48PM +0300, Rakotomandimby Mihamina wrote:

> Hello
> I made a simple CGI script, with some forms.
> I would like to
> - remove bad chars from input strings.
> - trim input strings (remove spaces, tabs, newlines,...)
>
> I would like to make some simple replace with simple regexes.
> I saw Str regexes use is simpler (to me) and Pcre probably more powerfull
> but not yet caught (by me).
>
> What would you recommend?

Pcre is a better library, easier to use and more powerful.

However Str has the advantage that it's part of the standard library
and doesn't involve installing anything else.  (Installing extra
libraries can be a problem for users on deficient OSes like Windows).

There is also micmatch/mikmatch, which is a very different approach to
the problem:

  http://martin.jambon.free.fr/micmatch.html

Rich.

--
Richard Jones
Red Hat