RegEx for Lahey Fortran

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
greatrussian
Posts: 5
Joined: Fri Apr 21, 2006 3:42 pm

RegEx for Lahey Fortran

Post by greatrussian »

I am new to regular expressions, however, I managed to figured out one for Lahey fortran yesterday, but for some reason it got deleted overnight, and now I can't recall it.

Error codes look like this:

Compiling program unit test01 at line 1:
2018-S: "test.for", line 7: When IMPLICIT NONE is specified, x must be declared in a type declaration statement.
Encountered 1 error, 0 warnings in file test.for.

This does not work:
^.+"\([:alpha:]+\)".+\([:digit:]+\)
File=1
Line=2

What am I doing wrong?
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post by MudGuard »

Code: Select all

^[^"]*"([^"]+)", line ([0-9]+):
should do the job. If you have posix switched off, add a \ before each ( and ).

What it does:
^
start at the beginning
[^"]*
any number of non-quotes
"
the first quote, starting the file name
([^"]+)
any number of non-quotes (will be remembered) - the file name
"
the second quote, finishing the file name
, line
the stuff between file name and line number
([0-9]+)
any number of digits (the line number, will be remembered).
:
the colon after the line number




[:alpha:] allows one of the characters ":", "a", "l", "p", "h".
[:alpha:] can be used within a character class, i.e. within [].
(similar for [:digit:] and the other character class operators).

But even [[:alpha:]] would not work, as your filename contains other characters than letters (e.g. the dot).
greatrussian
Posts: 5
Joined: Fri Apr 21, 2006 3:42 pm

Post by greatrussian »

Thanks, I hadn't realized that [:alpha:] would exclude the file name because of the period.
Post Reply