simont: A picture of me in 2016 (Default)
simont ([personal profile] simont) wrote2016-06-21 08:47 am

Regular language

I noticed yesterday after writing a comment in some code that one of my writing habits had changed, without me really noticing. So I thought I'd see what other people's opinions were.

Poll #17528 A regular holy war
Open to: Registered Users, detailed results viewable to: All, participants: 38


How do you write 'regular expression' in abbreviated form?

View Answers

regexp
11 (30.6%)

regex
24 (66.7%)

Something else
0 (0.0%)

I only ever write it unabbreviated
0 (0.0%)

I don't ever write it at all
1 (2.8%)

How do you pronounce the g in regexp / regex ?

View Answers

Hard, like in 'regular' (IPA /ɡ/)
23 (60.5%)

Soft, like in 'Reginald' (IPA /dʒ/)
13 (34.2%)

Something else
1 (2.6%)

I never pronounce these abbreviations
1 (2.6%)

pvaneynd: (Default)

[personal profile] pvaneynd 2016-06-22 10:47 am (UTC)(link)
At my work we often have to extract data from outputs our customer send us. More or less mutilated.

People often try to use regular expressions to parse this output which actually has a grammar. Instead of using a parsing tool to understand the grammar they write 'quick' regexp patterns which gets the data they are interested in.

Then they discover that another version give the data in a slightly different way. Another platform again slightly different. In the end the 'simple' regexp becomes a tangled mess of linenoise. For bonus points this pattern often has to ignore line endings and will be unbound, then applied on multi-megabyte files, in a loop.

Going for the simpler parser would have been much easier in the long run. Or at least a sane middle way like textfsm.