[sf-perl] regex help

Steve Fink sphink at gmail.com
Tue Oct 11 12:00:50 PDT 2011


Option 1:

s/^\s*\d+\.\s*//;

Option 2:

my ($sentence) = /^(?:\s*\d+\.\s*)?(.*)/;

or if you want to strip whitespace from the beginning of non-numbered
lines as well:

my ($sentence) = /^\s*(?:\d+\.\s*)?(.*)/;

2011/10/11 Richard Reina <gatorreina at gmail.com>:
> I have a file that has list of some sentences.  Some of them are numbered so
> I am going in circles trying to figure out how to remove the numbering.  The
> file is in the following format:
>
>     12. blah blah, blah blah blah. blah.
>  29. blah blah, blah.
>    19. blah blah blah.
>
> I am looking for a way to capture everything after the first dot so as to
> remove the numbering.
>
> Any help would be greatly appreciated.
>
> Thanks,
>
> Richard
>
> _______________________________________________
> SanFrancisco-pm mailing list
> SanFrancisco-pm at pm.org
> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm
>
>


More information about the SanFrancisco-pm mailing list