Re: Regular Expression Question

  • From: Veli-Pekka Tätilä <vtatila@xxxxxxxxxxxxxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Mon, 08 Oct 2007 22:44:24 +0300

Hi James,
Which flavor of regular expressions? I suppose you mean Perl 5
compatible or PCRE.

If you want to match the whole line better use the line beginning and
ending anchors directly as in:

^.*$

For matching the new line you could try to match the period i.e. all
non-new lines as few times as possible followed by a new line, and
starting at the beginning of a line. In other words:

^.*?\r\n

The latter assumes Windows and PCRE, where new lines are really made up
of a new line and a carrage return. MAny programming languages like Perl
convert to \n internally so in such cases pure \n should work, too. PCRE
has also a capital \R in NoteTab which matches both \r or \n or a combo
of both, I think, so:

^.*?\R

Your issue might be the line terminator, not the regexp engine per se.

These regexpes have been tested in NoteTab Pro 5.5 Windows XP.

Hope this helps.

-- 
With kind regards Veli-Pekka Tätilä (vtatila@xxxxxxxxxxxxxxxxxxxx)
Accessibility, game music, synthesizers and programming:
http://www.student.oulu.fi/~vtatila

james.homme@xxxxxxxxxxxx wrote:
> Hi,
> I tried and failed a few times to get this, but for some reason I am thick
> about regular expressions. I want to represent whatever might be on the
> current line. I don't care if the line is blank or if it has text on it. I
> want to represent everything from the beginning up to the new line. I think
> I want to include the new line, but I haven't thought that through yet. Is
> this how to do it?
> 
> ^.*\n

-- 
With kind regards Veli-Pekka Tätilä (vtatila@xxxxxxxxxxxxxxxxxxxx)
Accessibility, game music, synthesizers and programming:
http://www.student.oulu.fi/~vtatila
__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: