Regex
Advanced search syntax. Used for matching information against patterns. Uses:
* Input Validation
* Searching (& replacing)
* Data Scraping
* Syntax Highlighting
* Data Mapping
Syntax:
/ /
- Delimiters for the regexp
[ ]
- used to group a range of acceptable characters
A-Z
and0-9
- Sequential characters can be grouped
- Quantifier Characters:
?
- match 0 or 1 times (optional)*
- match 0 or more times+
- match 1 or more times{#}
- match an exact # of times
|
- or()
- used in conjunction w/|
to designate alternatives
Examples:
<[a-z]+[^>]*\s+{attr}\s*=\s*("[^"]*"|'[^']*'|[^\s >]*)
- used to find html tags with a specific attribute (`{attr}`)