In this example I want to match the whole line, up to but not including the first @ symbol. I've been using the following regex which is close, works on lines with only a single @ character but when there are two or more the look ahead assertion will capture up till the last one.
Tabs or space are allowed before the all-important '-' character.
Similarly comments are defined by a line that does not start with the '-' character and does not end with a ':'. Again, tabs and spaces are allowed at the start of the line and at the end. The regex I have been using is shown below. The problem is that while this is capturing comments it's also capturing lines with colons at the end of the line.
The second one only capture projects with a space after the colon.
I presume this is happening because the .* element is being greedy and capturing the colon too. I've not had any time to play around with this today so may try again tonight. I may create a more detailed example showing each of the elements.
Running TextPad 5.4 on Windows XP SP3 and on OS X 10.7 under VMWare or Crossover.
You specified that a comment is a line that does not start with the '-' character and does not end with a ':'. A line containing just Project:
with no spaces at the end does not start with a '-', but does end with a ':'. By your definition, that is not a comment.
Did you mean that a comment is a line that does not start with a '-' or does not end with a ':' ? If so, try ^\s*([^-].*|.*[^:])\s*$
or ^(?!\s*-.*:\s*$).*
The file is a text file associated with a Windows application called ToDoPaper and an OS X application called TaskPaper which use the same file format.
To create a syntax definition file for couple of text editors that use regex syntax definitions (PCRE) I have to define four elements for which the rules are:
A project entry is defined by the colon at the end of the line. The colon can be followed or preceded by spaces and the text may be inset with tabs or spaces.
A task is defined the '-' character being present at the start of the text but may be preceded by tabs or spaces. The entry ends with an end of line or tag.
A tag is defined by starting with a space followed by an '@' character.
A comment string is every thing else i.e. does not start with '-' or end with ':' or follow an '@'.
I'm still pottering about with this but only in a very desultory manner so far.
Running TextPad 5.4 on Windows XP SP3 and on OS X 10.7 under VMWare or Crossover.