Regular expression

P

Peter Fodrek

Dear conference!

I have third party regular expression

self.pattern_main = re.compile('(\s+|\w(?:[+])?\d*(?:\.\d*)?|\w\#\d+|\(.*?\)|
\#\d+\=(?:[+])?\d*(?:\.\d*)?)')

with code

def readline(self):
self.line = self.file_in.readline().rstrip()
if (len(self.line)) : return True
else : return False

while (self.readline()):
words = self.pattern_main.findall(self.line)


This handles text file like

// remark
PL_OFF
PARK
FS
MA 52.8806 , 18.0914
SS
AD_W
PL_ON
C 52.3955 , -16.1511 , -90.0000

It handles file correctly with two exceptions

1) omits ',' in the a output
2) omits minus sign in the numbers...

Would anyone recommend me what to change regular expression to add thesee two
think to the output,please?

Thank you for any help.

I look forward hearing form you
Yours faithfully

Peter Fodrek
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,069
Latest member
SimplyleanKetoReviews

Latest Threads

Top