6 Replies - 2106 Views - Last Post: 30 May 2014 - 06:53 AM

#1 jon.kiparsky  Icon User is online

  • Pancakes!
  • member icon


Reputation: 8029
  • View blog
  • Posts: 13,741
  • Joined: 19-March 11

Good regex introduction for smart, non-technical people?

Posted 13 May 2014 - 11:55 PM

So I know a number of people who work with computers but are not actually programmers. A number of them have recently asked me about how they would go about learning regular expressions, for various reasons. Mostly, it seems, because they've heard that they're useful and they want to learn the useful thing, but also because they work with large data files and want to parse them in various ways. Reasonable reasons, let's say.


Anyone have any suggestions I could pass on to them? I know about the Friedl book, but I haven't found that very useful so I'm hesitant to pass it on as a reference. What I'd like would be something that would give them enough basics that they could build on, but not something that tries to expose every detail of every implementation. I'd like something that would help them understand why (\d{3}[-\.]?\d{3}[-\.]?\d{4}) matches a US phone number, and to have them able to construct a regex of that sort, but not necessarily to dive in much further than that. About the level of understanding of regex that is conveyed by a good course in automata theory might be a way to characterize the requirement, but of course I'm not asking librarians and archivists to care about automata theory.

Any ideas are much appreciated

Is This A Good Question/Topic? 0
  • +

Replies To: Good regex introduction for smart, non-technical people?

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9579
  • View blog
  • Posts: 36,293
  • Joined: 12-June 08

Re: Good regex introduction for smart, non-technical people?

Posted 14 May 2014 - 06:53 AM

I am not sure if there is a specific book I can recommend, but I would advocate throwing them a few of the regex testing sites so they can play around. Most are 'on the fly' so they can see chunks of text being highlighted as they put in their symbols. I use them frequently.

http://regexpal.com/
http://www.myregextester.com/
Was This Post Helpful? 1
  • +
  • -

#3 cfoley  Icon User is offline

  • Cabbage
  • member icon

Reputation: 2069
  • View blog
  • Posts: 4,307
  • Joined: 11-December 07

Re: Good regex introduction for smart, non-technical people?

Posted 15 May 2014 - 02:40 AM

I like this site.

http://www.regular-expressions.info/

I find it very accessible and it has more depth than I have ever needed. It has a quick start section so you can start doing things straight away and a series of tutorials going increasingly in depth. I recommend doing what I did. Go through the quickstart and first couple of tutorials typing all the examples into a tester. Scan the remainder of the tutorials to get an idea of what is possible. For example, it's OK to know that you can look ahead and look behind without knowing the syntax. Then when you need to use it, use the site as a reference.

It looks like they have recently interspersed banner ads between the paragraphs. That's a shame. The content is still good and it's nothing a good ad blocker won't sort out anyway.
Was This Post Helpful? 2
  • +
  • -

#4 jon.kiparsky  Icon User is online

  • Pancakes!
  • member icon


Reputation: 8029
  • View blog
  • Posts: 13,741
  • Joined: 19-March 11

Re: Good regex introduction for smart, non-technical people?

Posted 15 May 2014 - 06:05 AM

Thanks for those. I've passed them on. I think the pairing of the tutorial and a regex tester will probably get them somewhere.
Was This Post Helpful? 0
  • +
  • -

#5 peace_fixation  Icon User is offline

  • D.I.C Head

Reputation: 46
  • View blog
  • Posts: 198
  • Joined: 01-November 11

Re: Good regex introduction for smart, non-technical people?

Posted 30 May 2014 - 06:18 AM

You can much around with regex in the javascript console of a web browser pretty quick and easy.

$> var re = new RegExp("\\d{6}");
$> re.test("123456");
$> true



I also use http://www.regular-expressions.info/ as a reference. I was actually doing regexes at work today, writing unit tests for a file parser, it was good practise.
Was This Post Helpful? 0
  • +
  • -

#6 josh_m_rodkey  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 24
  • Joined: 27-May 14

Re: Good regex introduction for smart, non-technical people?

Posted 30 May 2014 - 06:24 AM

Right here: http://www.regular-e...quickstart.html
Was This Post Helpful? 0
  • +
  • -

#7 DarenR  Icon User is offline

  • D.I.C Lover

Reputation: 498
  • View blog
  • Posts: 3,317
  • Joined: 12-January 10

Re: Good regex introduction for smart, non-technical people?

Posted 30 May 2014 - 06:53 AM

have you checked out this ?

http://www.regexr.com/
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1