Does the use of regular expressions go beyond simple text matching?

They're called "regular expressions" because they're based on regular grammars which are one of several types of grammar-as-mathematical-object discovered by linguists and computers scientists in the last 50 years.

Answer by Phil Jones:

They're called "regular expressions" because they're based on regular grammars which are one of several types of grammar-as-mathematical-object discovered by linguists and computers scientists in the last 50 years.
Regular grammars are useful in that you can very easily describe matches for a whole range of patterns in any kind of sequence of tokens. Normally we use them to match text, but I've seen them being used, for example, to match sequences of simple strokes (up, down, left, right) into hand-written characters etc.
They're very powerful for a very concise (and fairly easy to understand) pattern matching language.
However they aren't powerful enough to match everything we're interested in. In particular, they aren't powerful enough to pattern match things that have a recursive structure. For example, you can't use them to parse code written in a programming language that has nested blocks. For this, you need a different kind of parser based on a different type of grammar.

Does the use of regular expressions go beyond simple text matching?

Advertisements

Leave a comment

Filed under Life

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s