How to enable "multi line mode" in go package "regexp"

8,601 views
Skip to first unread message

Hailei Hu

unread,
Feb 2, 2015, 10:32:26 PM2/2/15
to golan...@googlegroups.com
I want to enable "multi line mode" when using package "regexp", and I read the docuemnt, it told me that I can use the flag "m". But I could not find any example how to use this flag.
So could anyone show me an example? Thanks in advance.

Caleb Spare

unread,
Feb 2, 2015, 10:39:02 PM2/2/15
to Hailei Hu, golang-nuts
Example:


The documentation is in http://golang.org/pkg/regexp/syntax/ just above where all the flags are listed (if you search for "flags" on that page it's the second match).

On Mon, Feb 2, 2015 at 7:32 PM, Hailei Hu <neverlosey...@gmail.com> wrote:
I want to enable "multi line mode" when using package "regexp", and I read the docuemnt, it told me that I can use the flag "m". But I could not find any example how to use this flag.
So could anyone show me an example? Thanks in advance.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ian Lance Taylor

unread,
Feb 2, 2015, 10:44:25 PM2/2/15
to Hailei Hu, golang-nuts
On Mon, Feb 2, 2015 at 7:32 PM, Hailei Hu
<neverlosey...@gmail.com> wrote:
Use (?m) to turn on the m flag.

http://play.golang.org/p/Fq14BXWuGH

Ian

Hailei Hu

unread,
Feb 3, 2015, 12:07:21 AM2/3/15
to golan...@googlegroups.com
Thanks for these help. This is really what I want. I think it would be better if such examle could be added to the document.
Reply all
Reply to author
Forward
0 new messages