Regular Expressions
From TekiWiki
This whole wiki has now moved to http://www.springboardsolutions.com/wiki
Go to this page Regular Expressions
(Created page with "A Regular Expression is a compact way to express a text search or replacement. Regular expression calculator [http://www.homemarketeer.com/sbs/regular_expression.html]") |
|||
| Line 1: | Line 1: | ||
A Regular Expression is a compact way to express a text search or replacement. | A Regular Expression is a compact way to express a text search or replacement. | ||
| - | Regular expression calculator [http://www.homemarketeer.com/sbs/regular_expression.html] | + | * Regular expression calculator: [http://www.homemarketeer.com/sbs/regular_expression.html Regular Expression Calculator] |
| + | |||
| + | * Regular expression text calculator: [http://www.homemarketeer.com/tools/text_processor Regular Expression Text Processor] | ||
| + | |||
| + | * Regular expression information: [http://www.homemarketeer.com/sbs/regexp.htm Regular Expression Information] | ||
| + | |||
| + | * Using Regular Expressions in PeopleSoft - [[PeopleSoft Regular Expressions]] | ||
| + | |||
| + | [[Regular Expression Examples]] | ||
| + | |||
| + | ==About Regular Expressions == | ||
| + | A Regular Expression is a compact way of expressing patterns to search for and, optionally, a replace. It started life within Unix grep, but has now been implemented in many different technologies, for example: | ||
| + | |||
| + | Languages: AWK, Perl, Java, JavaScript | ||
| + | |||
| + | Text Editors: TextPad, UltraEdit | ||
| + | |||
| + | Over the years, there have been extensions to the Regular Expression syntax, but there is a core which all implementations accept. | ||
| + | |||
| + | ==Search String Rules== | ||
| + | |||
| + | ^ - matches start of line | ||
| + | |||
| + | $ - matches end of line | ||
| + | |||
| + | . - matches any single character | ||
| + | |||
| + | [abc] - matches single a or b or c | ||
| + | |||
| + | [^abc] - matches a character other than a or b or c | ||
| + | |||
| + | (ab|cd) - matches ab or cd | ||
| + | |||
| + | <nowiki>* - matches zero or any number of the previous character/expression</nowiki> | ||
| + | |||
| + | + - matches one or more of the previous character/expression | ||
| + | |||
| + | ? - matches zero or one of the previous character/expression | ||
| + | |||
| + | {3} - matches three of the previous character/expression | ||
| + | |||
| + | {3,} - matches at least three of the previous character/expression | ||
| + | |||
| + | {3,5} - matches between three and five of the previous character/expression | ||
| + | |||
| + | \n - matches New Line character | ||
| + | |||
| + | \t - matches Tab character | ||
| + | |||
| + | \f - matches Form Feed character | ||
| + | |||
| + | \r - matches Carriage Return character | ||
| + | |||
| + | \v - matches Vertical Tab character | ||
| + | |||
| + | \d - matches any digit | ||
| + | |||
| + | \D - matches a character other than a digit | ||
| + | |||
| + | \w - matches any letter, digit or underscore (_) | ||
| + | |||
| + | \W - matches a character other than a letter, digit or underscore (_) | ||
| + | |||
| + | \s - matches any white space | ||
| + | |||
| + | \S - matches a character other than a white space | ||
| + | |||
| + | \b - matches a word boundary | ||
| + | |||
| + | \B - matches a character other than a word boundary | ||
| + | |||
| + | \. - matches an actual dot (works for all meta characters - including \) | ||
| + | |||
| + | Other characters match with themselves | ||
| + | |||
| + | ==Replacement String Rules== | ||
| + | |||
| + | & - replace with entire matched string | ||
| + | |||
| + | $1 ... $99 - replace with first ... ninety-ninth matched bracketed () expression (provided there are that many in the match expression) | ||
| + | |||
| + | ==Other Links== | ||
| + | |||
| + | [[NI Number Validation]] | ||