A regular expression is a pattern used to match text. Regular expressions are used for text processing in many programming languages (for example, Perl) and in UNIX utilities such as grep. They share common semantics and you are best looking online for additional information on regular expressions.
In SAT, the Regular Expression Replace string modifier lets you match a string against an regular expression and then replace it accordingly. Here is an example:
Source data:
Surname Forename Smith Bob Jones Rob
If you pass Forename through this regular expression: Regular Expression: (Bob|Rob)
Replacement: Robert
Bob and Rob become Robert.
You must exercise caution with regular expressions and consider their impact across your source data. Regular expressions do exactly what you ask. This can have undesired consequences. For example, if the example regular expression was used against the input string Robert, you would get Robertert. This is because it has matched Rob and replaced it with Robert. To avoid this, the regular expression would need to be (Bob|Rob)$. The $ symbol means match at the end of a string only.
You can find a copy of this article via the attached word document.
Comments
0 comments
Please sign in to leave a comment.