regular expressions in fortran90, 95

  • Permalink
  • submit to reddit
  • Email
  • Follow


Greetings,

Is there any possibility to use the subject?

Thanks a lot in advance.

regards,
Anton.

0
Reply narod (25) 1/21/2004 2:55:02 PM

See related articles to this posting


Anton Ishmurzin wrote:
> 
> Greetings,
> 
> Is there any possibility to use the subject?
> 
> Thanks a lot in advance.
> 
> regards,
> Anton.

I do not know of a ready solution, but it is possible
to take a C library and call that (possibly via a 
few wrapper functions) from Fortran.

(I have contemplated writing such wrapper functions 
but I have not found the energy to actually do it yet ;).

In principle it is no problem - Fortran offers all the
tools you need, but the very task of writing a regular
expressions matcher is mind-boggling.

Regards,

Arjen
0
Reply arjen.markus (2628) 1/22/2004 8:14:14 AM

Arjen Markus (aka Bruce) was almost, but not quite, entirely unlike tea:
> I do not know of a ready solution, but it is possible
> to take a C library and call that (possibly via a 
> few wrapper functions) from Fortran.
> 
> (I have contemplated writing such wrapper functions 
> but I have not found the energy to actually do it yet ;).
> 
> In principle it is no problem - Fortran offers all the
> tools you need, but the very task of writing a regular
> expressions matcher is mind-boggling.

If we could portably use popen(), you could invoke perl :)

-- 
TimC -- http://astronomy.swin.edu.au/staff/tconnors/
If a train station is a place where a train stops, what's a workstation?
0
Reply tconnors (94) 1/22/2004 12:46:17 PM

TimC wrote:
> 
> Arjen Markus (aka Bruce) was almost, but not quite, entirely unlike tea:
> > I do not know of a ready solution, but it is possible
> > to take a C library and call that (possibly via a
> > few wrapper functions) from Fortran.
> >
> > (I have contemplated writing such wrapper functions
> > but I have not found the energy to actually do it yet ;).
> >
> > In principle it is no problem - Fortran offers all the
> > tools you need, but the very task of writing a regular
> > expressions matcher is mind-boggling.
> 
> If we could portably use popen(), you could invoke perl :)
> 

A portable interface between C and Fortran is not that 
difficult :) - it just takes some time to realise.
All the technical stuff can be adequately solved via
"cfortran.h". The interface needs to be defined in 
a way that is comfortable for Fortran programmers.
That is where ingenuity comes along...

As far as popen() is concerned, is that not part of
POSIX? Doesn't  POSIX have a Fortran-component?

Regards,

Arjen
0
Reply arjen.markus (2628) 1/22/2004 1:14:47 PM

> Doesn't  POSIX have a Fortran-component?

It has a Fortran language binding, yes. I'm not sure any (useful)
implementations exist.

	Jan
0
Reply jvorbrueggen (238) 1/22/2004 1:43:54 PM

Anton Ishmurzin <narod@izh.com> wrote in message news:<400E92C6.9000100@izh.com>...
> Greetings,
> 
> Is there any possibility to use the subject?
> 
> Thanks a lot in advance.
> 
> regards,
> Anton.

If you do not need the full power of regular expressions, you can
probably solve your problem using the intrinsic Fortran
string-handling functions, such as

INDEX
VERIFY
SCAN
TRIM
ADJUSTL

The book "The Practice of Programming" by Brian W. Kernighan and Rob
Pike show how MOST of grep can be implemented in a fairly small C
code. If that is all you need, translating their code to Fortran
should not be too hard. The code from his book can be downloaded from
http://cm.bell-labs.com/cm/cs/tpop/code.html .

The book "Software Tools" by Kernighan and Plauger has string-handling
code in RATFOR, which can be translated to Fortran using the RATFOR
preprocessor. The code is at
http://cm.bell-labs.com/cm/cs/who/bwk/toolsbook/index.html , in some
strange format.

"Fortran tools for VAX/VMS and MS-DOS"
Jones and Crabtree (1988) 
is a very good book with lots of string-handling code in Fortran 77

"Algorithms and Data Structures in F and Fortran" 
by Robin Vowels (1988)
has lots of string-handling code in Fortran 90/95
0
Reply beliavsky (2211) 1/22/2004 2:40:51 PM

Jan C Vorbr�ggen (aka Bruce) was almost, but not quite, entirely unlike tea:
>> Doesn't  POSIX have a Fortran-component?
> 
> It has a Fortran language binding, yes. I'm not sure any (useful)
> implementations exist.

There's pxfpopen() in Intel FC. 

It returns a fd, not a lun, so one must do nasty things with dup2(),
in order to be able to use write and read transparently. Why I call
this unportable, is because as it is; I had to perform many unexpected
hacks because of some sub-optimalities in the buffering of Intel's
implementation of write/read (seeking all over the place, unless you
open on a fifo before the dup2, in which case it chooses to read/write
one byte at a time -- yuck)

-- 
TimC -- http://astronomy.swin.edu.au/staff/tconnors/
Kleeneness is next to Godelness.
0
Reply tconnors (94) 1/22/2004 9:12:32 PM
comp.lang.fortran 11029 articles. 36 followers. Post

6 Replies
265 Views

Similar Articles

[PageSpeed] 29


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

Regular expression to match regular expressions?
An expression parser (in TAWK) accepts textual regular expressions, which are then converted to internal form by TAWK's regex() function. If the regular expression is ill-formed, then TAWK's run-time package issues an error message on the console (rather than, say, returning a null value from regex()). Is there a cheap way to verify that a regular expression is properly formed *before* feeding it to regex(), so as to avoid that error message? A first thought: regex = /^\/.+\/i?$/ - starts and ends with '/' or '/i' (i-gnore case), must be non-null A second thought:...

The power of regular expressions without regular expressions.
I'm not talking here about the relatively simple, quick and dirty, one-time regular expressions that you might interactively feed to grep. Rather, I'm talking about the more complex regular expressions that might appear in your Java programs. For many of us, regular expressions that are not fairly simple, are an unreasonable challenge, are effectively "write only" and so are virtually unmodifiable. Are you tired of escaping escapes of escapes and of things like " (.*) (\\d+|@|_)\\[(\\S+)( +)((-?)(\\d+\\.\\d\\d))" and "((?:(?:[...

C++ regular expression Vs. Perl regular Expression
Hi all, In Perl the RegExpr is very good use, it allows programmer to do everything they want to do, start from simple text file to a large programm parsing user input. However, I never come across C++ regular expression that able to do what perlist can do???? Thank. [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] "phal" <betterdie@gmail.com> writes: > Hi all, > > In Perl the RegExpr is very good use, it allows programmer to do > everything they want to do, start from simpl...

How to express a math expression in a single regular expression?
Hi, I have built a comprehensive grammar to build a syntax tree, which transforms a math expression into a postfix form. The math expressions may contain array, which is described in between "[" and "]", index of the arrays are divided by ",". The indices are surely math expressions as well. Such as "a[3+b, 6] = 4 + d*5". My idea is, outside array brace '[' and ']', the math expression shall be built into syntax tree, but inside array brace, the operation is just get what the expression is. The above expression shall process...

Regular expression from end of another regular expression till end of line
Hi, There are lines which have numerical substrings of 15 or 16 characters length in them. The regular expression (\d{15,16}) matches this string. I want to extract the portion after this 15/16 character string till end of the line. Can this be done using a regular expression? Thanks in advance for the help. Regards, Raj On 5/1/2010 6:31 AM, Rajendra wrote: > Hi, > > There are lines which have numerical substrings of 15 or 16 characters > length in them. > > The regular expression (\d{15,16}) matches this string. I want to > extract the portion after this 15/16 chara...

Can they be expressed as regular expression?
Dear all, 1-way Finite automata can be used to test whether a given string match a particular regular expression. However, I am wondering whether it would work the other way around: Given a string, and a regular expression, how many times do the regular expression match with the string? This is clearly computable by Turing-powerful machine, but I would like to know whether I could just use Finite automata to solve the above problem. However, the above question needs to be rephrased/modified before it is meaningful in the context of finite automata. My first attempt failed to capture the full...

What is regular about regular expressions nowadays?
The language {ww | w is alpha} has been shown to be context-sensitive. But the perl regular expression /(\w*)\1/ will recognize it. There are constructs supported by some regex engines (.NET, for example) that allow sections to be tagged and Why do we insist on calling these "regular"? Anything with back-references or tagging of any sort can't be expressed as DFAs or NFAs because one is not supposed to be able to keep a memory of the input. Still, all books that talk about regex engines talk about NFAs and backtracking. Something like {ww} requires an equivalent LBA (linear bou...

is there any regular expression tool for vs2005? Advanced Telesoft, Super Programmer, Dan is there any regular expression tool for vs2005? Super Programmer
is there any regular expression tool for vs2005? Advanced Telesoft, Super Programmer, Dan from hkhellhkhell@hotmail.com hkhellhkhell@hotmail.com wrote: > is there any regular expression tool for vs2005? > Advanced Telesoft, Super Programmer, Dan > from hkhellhkhell@hotmail.com Hey, do you realise there's chap over on comp.lang.java.programmer getting grief for being the same person as the one (you) who sent around 60 spamming posts to various technical newsgroups in September ? You should really get your own IP address and stop giving him a bad name. -- chris ...

is the language of regular expressions a regular language?
The set REX of regular expressions over the alphabet {a, b} is itself a language over the alphabet {e,0 , a, b, ), (*,U, .} is this language regular? I want to say yes, however, I am not sure what approach to take? Which would be easiest? Construct a DFA or a regular expression? Or am I wrong and this language is not regular? TheGist writes: > The set REX of regular expressions over the alphabet > {a, b} > is itself a language over the alphabet > {e,0 , a, b, ), (*,U, .} > > is this language regular? > > I want to say yes, however, I am not sure what approac...

Matching abitrary expression in a regular expression
Hi, How to match a mathematical expression in a single regular expression? moopT wrote: > How to match a mathematical expression in a single regular expression? You can't. Mathematical expressions make use of nested brackets. Regexps don't have the power to handle arbitrarily nested constructs. -- chris moop� wrote: > Hi, > How to match a mathematical expression in a single regular expression? ..* Chris Uppal <chris.uppal@metagnostic.REMOVE-THIS.org> wrote: > You can't. Mathematical expressions make use of nested brackets. Regexps > don't ...

How to print all expressions that match a regular expression
Hi, I am a fresh man with python. I know there is regular expressions in Python. What I need is that given a particular regular expression, output all the matches. For example, given =93[1|2|3]{2}=94 as the regular expression, the program should output all 9 matches, i.e., "11 12 13 21 22 23 31 32 33". Is there any well-written routine in Python or third-party program to do this? If there isn't, could somebody make some suggestions on how to write it myself? Thanks. Zhuo In article <ee2cfd35-3171-4ee7-ad3a-cf117e5527c5@r24g2000yqd.googlegroups.com>, "hzhuo1@gmai...

How can this Perl regular expression be expressed in Python?
Here's a large Perl regular expression, from a Perl address parser in CPAN: use re 'eval'; $Addr_Match{street} = qr/ (?: # special case for addresses like 100 South Street (?:($Addr_Match{direct})\W+ (?{ $_{street} = $^N }) ($Addr_Match{type})\b (?{ $_{type} = $^N })) | (?:($Addr_Match{direct})\W+ (?{ $_{prefix} = $^N }))? (?: ([^,]+) (?{ $_{street} = $^N }) (?:[^\w,]+($Addr_Match{type})\b (?{ $_{type} = $^N })) (?:[^\w,]+($Ad...

Seek xpath expression where an attribute name is a regular expression
For starters .... If : //input[@name='start_date'] is the xpath syntax to see if an element with an attribute named start_date exists ... Then what is the xpath syntax to return elements having an attribute named '*date*' . That is there a way to turn start_date into a regular expression? Thanks! GIMME wrote: > For starters .... > > If : > > //input[@name='start_date'] > > is the xpath syntax to see if an element with an attribute > named start_date exists ... No, that expression looks for <input> elements at all levels that...

Regular Expressions
Please help me understand regular expressions. I have read different articles about them, they all seem to explain it differently. 1. On one site it says to do it like this: return ( /^[0-9]+$/.test(num) ) 2. On another it says: var regExp = new RegExp(/^[a-zA-Z0-9]+$/) return ( regExp.test(str) ) 3. I see others that put the expression into a string and then test it. I have tried both 1 and 2, and on some clients 2 will work, but on others it always returns false no matter what. What's the difference between them? How do I know what is going to work on all clients? Is there a way ...

what is regular expression
Hi I want to know what mean by regular expression in C++ Mayur "MJ" <mayurdjain@gmail.com> wrote in message news:1121150492.356974.53640@g43g2000cwa.googlegroups.com > Hi > I want to know what mean by regular expression in C++ Regular expression is not C++ specific. A regular expression is simply a pattern for text, e.g., you might have two letters, followed by a dash, followed by four digits. Regular expressions are used for various types of text processing, e.g., search and replace or the validation of input (to make sure it is in the correct format). A library ...

Regular Expressions
I have some files whose file names are like this: asdf1.jpg qer10.jpg rwytew45.jpg So, I want to rename all the files that has only one digit to a two digit number to make them alphabetically correct in the listing like this: adsf01.jpg I tried to do it like this: for($i=0; $i<count($files); $i++) { print preg_replace("|(\w+)(\d)(\.jpg)|", "\${1}0\$2\$3", $files[$i]); } but it's not working. It converts all the files like this: asdf1.jpg => asdf01.jpg qer10.jpg => qer100.jpg rwytew45.jpg => rwytew405.jpg It doesn't seem to care about me wanti...

regular expression ?
Hi All, what' is the regular expression to extract character string within [ ] ? e.g. 'testing [field1] and this is [field2] also [field3] ' and extract field1, field2, field3 from this string ? Thanks -- .. "fatfat" <fatfat@fatfat.com> wrote in message news:fmhec1$hdc$1@aioe.org... > Hi All, > what' is the regular expression to extract character string within [ ] ? > > e.g. 'testing [field1] and this is [field2] also [field3] ' > and extract field1, field2, field3 from this string ? > > Thanks > Hi fatfat You can use \w ...

Regular Expression for {
String input = "DATA,{23.11,58.25},{23,33,43},{20070705,20070805}";String[] splitLine = input.split(",{");doesn't work. I've tried escaping the { by usingString[] splitLine = input.split(",\{");but Eclipse tells me that { is not an escapable character.Anybody have a suggestion???Thanks! On Apr 17, 12:10 pm, sciflu...@gmail.com wrote:> String input = "DATA,{23.11,58.25},{23,33,43},{20070705,20070805}";>> String[] splitLine = input.split(",{");>> doesn't work. I've tried escaping the { by using>> String[] ...

regular expressions?
Hi all.. I'm in need of some help.. I'm looking after a subversion machine with many repositories and many users in the passwd files for each.. Currently when I want to get rid of one of the users, I normally have to go through each repository, look in the passwd file and delete the user manually.. I'm assuming with perl I might be able to make up a quick script that will look inside each repo, find the line with the user, delete it and save the file.. It will save a lot of my time.. Either a perl script or a shell script might be suitable for this.. All I got at the moment is...

regular expressions
This is was part of a homework problem (I know how everyone lovesthose :-) ) but now the homework is turned in, and I am left with anagging question.I was trying to find a good resource for regular expressions on theweb-but couldn't really find anything that was cut and paste.In any event, was wondering if anyone had an opinion on a good regextutorial. I have recently purchased "mastering regular expressions"from O'Reilly-but haven't had an opportunity to begin reading it inearnest.The problem in question:Attempting to use a regex pattern to verify if a String has two al...

Regular Expressions
Dear fellow developers, I am looking for a good regular expressions handling library. Am developing an application under Fedora Linux and putting "include <regex.h>" in my code does not make my compiler complain. I assume this is the library documented in http://www.opengroup.org/onlinepubs/000095399/basedefs/regex.h.html document. However I am wondering whether regex.h library is okay, or would you guys recommend me to use something else (Boost RegEx libraries for example?)? Cheers, Alex On 2007-12-28 13:48, alexrixhardson@yahoo.com wrote: > Dear fellow developers, > ...

About a regular expression
Hi, I really don't unserstand why my regular expression don't scan a string. My goal is to match in a string a domain name. I copy/past my code here: -------------------------------- #! /usr/bin/env ruby domain_name = "[a-zA-Z0-9-]{1,63}\.(aero|biz|cat|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|travel|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq...

Regular expressions again
I must be missing something, but I don't know what... alert( source.indexOf("source") ); var e3="\/source\/ig"; source=source.replace( e3, "pqrst" ); alert( source.indexOf("pqrst") ); The first alert shows 8937, so the substring exists. Therefore, "pqrst" must appear no later than 8937 in source, right? So why in the world would I get 9091 for the second alert? -- Christopher Benson-Manica | I *should* know what I'm talking about - if I ataru(at)cyberspace.org | don't, I need to know. Flames welcome. Christopher Benson-M...

regular expression
Hi, I am having a variable $msg with value "STOP xyz123 is stopped" I need to collect xyz123 alone (i.e any alphanumeric combination which follows "STOP" word should be picked.) I am not sure whether STOP is followed by \r (or) \n. Any info...Thanks Jai wrote: > Hi, > I am having a variable $msg with value > "STOP > xyz123 is stopped" > > I need to collect xyz123 alone (i.e any alphanumeric combination which > follows "STOP" word should be picked.) I am not sure whether STOP is > followed by \r (or) \n. > > Any inf...