Regular Expressions: Difference between revisions

From Psygen Wiki
Jump to navigation Jump to search
(Created page with "Coming soon... == References == <ol> <li>[http://ryanstutorials.net/linuxtutorial/grep.php Ryan's Tutorials Grep and Regular Expressions]</li> </ol>")
 
No edit summary
Line 1: Line 1:
Coming soon...
A regular expressions is a standard way of using text to form a search to match patterns.
 
Similar to using an asterisk like this: <code>*.jpg</code> in a search box to find all JPEG files, you can use a regular expression (along with something like [[grep]]) to match much more complex patterns.
 
For example, you could use:
 
<code> \b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b </code>
 
to search for any e-mail addresses in a file
 
== Cheat Sheet ==
 
 




Line 6: Line 18:
<ol>
<ol>
     <li>[http://ryanstutorials.net/linuxtutorial/grep.php Ryan's Tutorials Grep and Regular Expressions]</li>
     <li>[http://ryanstutorials.net/linuxtutorial/grep.php Ryan's Tutorials Grep and Regular Expressions]</li>
    <li>[http://www.regular-expressions.info/ Regular Expressions Info]</li>
</ol>
</ol>

Revision as of 02:42, 23 December 2016

A regular expressions is a standard way of using text to form a search to match patterns.

Similar to using an asterisk like this: *.jpg in a search box to find all JPEG files, you can use a regular expression (along with something like grep) to match much more complex patterns.

For example, you could use:

\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b

to search for any e-mail addresses in a file

Cheat Sheet

References

  1. Ryan's Tutorials Grep and Regular Expressions
  2. Regular Expressions Info