re2

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

re2

Анна Мухаррам
Hello everyone!

With use of re library it is possible to get all words in string with command:

  re:run("word1, word2 ,word3", "[a-z0-9]+", [global, {capture, all, binary}]).
  {match,[[<<"word1">>],[<<"word2">>],[<<"word3">>]]}


 But re2 doesn't have global option. So with re2 I get:

re2:run("word1, word2 ,word3", "[a-z0-9]+", [{capture, all, binary}]).       
{match,[<<"word1">>]}


How could I find all words in string with re2?

Thank you!

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Led
Reply | Threaded
Open this post in threaded view
|

Re: re2

Led
2018-08-01 20:53 GMT+03:00 Анна Мухаррам <[hidden email]>:
Hello everyone!

With use of re library it is possible to get all words in string with command:

  re:run("word1, word2 ,word3", "[a-z0-9]+", [global, {capture, all, binary}]).
  {match,[[<<"word1">>],[<<"word2">>],[<<"word3">>]]}


 But re2 doesn't have global option. So with re2 I get:

re2:run("word1, word2 ,word3", "[a-z0-9]+", [{capture, all, binary}]).       
{match,[<<"word1">>]}


How could I find all words in string with re2?

Thank you!


 [{offset, Offset}, {capture, all, index}] with recursion.

But... Why???

--
Led.

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: re2

Raimo Niskanen-2
In reply to this post by Анна Мухаррам
On Wed, Aug 01, 2018 at 08:53:33PM +0300, Анна Мухаррам wrote:

> Hello everyone!
>
> With use of *re* library it is possible to get all words in string with
> command:
>
>   re:run("word1, word2 ,word3", "[a-z0-9]+", [global, {capture, all,
> > binary}]).
> >   {match,[[<<"word1">>],[<<"word2">>],[<<"word3">>]]}
> >
>
>  But *re2* doesn't have *global* option. So with *re2* I get:
>
> re2:run("word1, word2 ,word3", "[a-z0-9]+", [{capture, all,
> > binary}]).
> > {match,[<<"word1">>]}
> >
>
> How could I find all words in string with *re2*?

Have you tried to create an issue at
  https://github.com/tuncer/re2/
which I guess this question is about...?

Or at the source library:
  https://github.com/google/re2
that implements it?


>
> Thank you!


--

/ Raimo Niskanen, Erlang/OTP, Ericsson AB
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions