Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 20.6 ('Nashville 2022')
Instant purchase and download via GumRoad!

COLUMN

Regular Expressions with Xojo

The MBS Plugins has its own RegEx library

Issue: 20.6 (November/December 2022)
Author: Stefanie Juchmes
Author Bio: Stefanie studied computer science at the university in Bonn. She came in touch with Xojo due to the work of her brother-in-law and got a junior developer position in early 2019 at Monkeybread Software.
Article Description: No description available.
Article Length (in bytes): 14,211
Starting Page Number: 65
Article Number: 20608
Resource File(s):

Download Icon project 20608.zip Updated: 2022-10-31 22:45:03

Related Link(s): None

Excerpt of article text...

Say you want to search for email addresses in some text and extract only these addresses from the text. Or you want to replace all internet addresses with a new internet address of your own. In these cases, regular expressions are a good solution.

What regular expressions are and how you can use them in Xojo with the MBS Xojo plugins I will show you in this article. The MBS Xojo plugin uses the PCRE 2 (Perl Compatible Regular Expressions) C-library. This provides us an engine with which we can work with regular expressions.

What are regular expressions?

With regular expressions you can search for certain patterns in some text or check a string to see if it meets certain criteria. e.g. if the chosen password contains upper and lower case letters, at least one number, one special character, and is at least eight characters long.

If we search for something in a text search then we actually are always searching for a regular expression. For example, if we enter the word Miss, then we are really searching for a pattern in the text that looks for the letters M-i-s-s that are next to each other.

If we find the word Miss but also the word Mississippi. If we tell the program that we don't care about upper and lower case letters we might also find the word missed. So we are looking for a pattern where the four letters appear exactly in this order. This is already a regular expression.

...End of Excerpt. Please purchase the magazine to read the full article.