Tuesday, December 25, 2012

Regex for matching the section in vim help files

Hi,

what would be a regular expression to match the section in vim help
files?

==============================================================================
3. Simple changes *simple-change*
^^^^^^^^^^^^^^

==============================================================================
4. Complex changes *complex-change*
^^^^^^^^^^^^^^^

4.1 Filter commands *filter*
^^^^^^^^^^^^^^^

I have no problems matching the line, but I cannot successfully
match only the section title within the line. I'm not sure if it's
allowed in vim help files, but in my file the titles would also
contain other characters than [a-zA-Z] and that's where my current
regex fails. Example:

==============================================================================
5. Språket ifrågasätts *complex-languages*

5.2 Rock'n'Roll *rock*

So basically this should be sufficient:

"match everything from one or more spaces to everything
before two or more spaces"


Marco

No comments:

Post a Comment