[wplug] Regex help?
Michael Skowvron
michaels at penguincentral.org
Mon Apr 27 16:40:06 EDT 2015
Try this:
"^([0-9]\.){1,4} "
^ - match at the beginning of the line
( - a pattern that is
[0-9] - a number followed by a
\. - period
) - end this pattern
{ - specify that this pattern may repeat
1 - 1 to
4 - times
}
" " and then a space after the last period
Michael
On Mon, Apr 27, 2015 at 3:01 PM, Doug Green <diego96 at mac.com> wrote:
> Hi all,
> I've got some work data that I'm trying to clean up. It's a single column
> of Excel data, each row contains a chapter/section/subsection/paragraph
> number followed by a string of text. I'd like to separate the heading
> numbers into a different column than the body of the text (creating a two
> column data set).
>
> My plan was to do a CSV export, then add a comma after the number. By
> re-importing the CSV this <should> put the section number in a different
> column than the text. Example:
>
> 7.1.3.2. Section describing general attributes of an item.
>
> Converted to:
>
> 7.1.3.2., Section describing...
>
> Emacs has a convenient replace-regex function that simply asks first what
> regex you want to search for and next what you want to replace it with.
> I've tried every combo of "[0-9]\." and "[:digit:]\." but I'm not matching
> ANY results. Can anyone point me in the right direction for a little help
> on writing a generalized regex that will match "any number followed by a
> period, optionally followed by up to 3 more numbers each followed by
> periods"? Clear as mud, right?
>
> Thanks!
> _______________________________________________
> wplug mailing list
> wplug at wplug.org
> http://www.wplug.org/mailman/listinfo/wplug
>
More information about the wplug
mailing list