FANDOM


Regular expressions are a powerful pattern-matching tool. They allow patterns to be specified concisely and flexibly.

For example, a regular expression to match a Zip code might look like

\d{5}(\-\d{4})?

-- 5 digits, optionally followed by a dash and 4 more digits.

Craig Boyd has written an FLL called RegExp that allows VFP to use regexps without calling out to a COM library, as the FFC class does. Using it, we see that:

lcZipRegex = "\d{5}(\-\d{4})?"

?regexp("02908", lcZipRegex)       && .T.
?regexp("02908-2148", lcZipRegex)  && .T.
?regexp("029082175", lcZipRegex)   && .F.

An equivalent comparison in Xbase code would be quite a bit wordier.

External linksEdit

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.