Picture of Regex Text Manipulations | IV_016

Regex Text Manipulations | IV_016

In this tutorial, we learn how to utilise Regex (Regular Expression) Text Manipulation to format text strings. These can be set up on a text variable within Infigo Invent, in order to ensure consistency of data formats on your products. Regex (regular expressions) is a powerful tool for text manipulation that allows you to search, match, and manipulate patterns within strings of text. It is not specific to Infigo, so there are loads of internet resources available to assist with the creation of Regex expressions.

Tutorial Video Transcript

A transcript of our tutorial video, ensuring you can find exactly what you need, when you need it.

You can search this page to find the relevant time-stamp in the video. Also, this text can be used as part of the tutorial search feature.

00:00:11:21 - 00:00:15:03
RegEx
or regular expressions is a powerful tool

00:00:15:03 - 00:00:17:16
for text manipulation
that allows you to search,

00:00:17:16 - 00:00:20:24
match and manipulate patterns
within strings of text.

00:00:21:10 - 00:00:24:26
So a brief summary of Regex
text manipulation,

00:00:24:26 - 00:00:28:05
which will go on to in a minute
and how you can use it within Infigo.

00:00:28:24 - 00:00:31:24
So there's a few things
that you can do with it.

00:00:31:24 - 00:00:36:03
So pattern matching being one
regex enables you to search for specific

00:00:36:03 - 00:00:39:16
patterns or sequences of characters
within a text string

00:00:40:14 - 00:00:45:09
by defining a pattern
using special syntax and meta characters,

00:00:45:09 - 00:00:47:22
you can find matches
within the target text.

00:00:49:15 - 00:00:53:15
You can also do string searching,
so Regexs allows you to perform advanced

00:00:53:15 - 00:00:57:09
search operations, which is finding
all occurrences of a specific word

00:00:57:20 - 00:01:00:08
or identifying patterns
that follow certain rules.

00:01:00:27 - 00:01:03:18
It provides
more flexibility than simple string

00:01:03:18 - 00:01:07:25
searches, validation

00:01:07:25 - 00:01:12:28
and extraction, so regex can be used to
validate and extract specific information

00:01:12:28 - 00:01:17:20
from text for example,
you can validate email addresses, URLs

00:01:17:27 - 00:01:21:02
or phone numbers
by defining regex patterns

00:01:21:10 - 00:01:24:10
match the expected format.

00:01:25:13 - 00:01:25:28
We've also got

00:01:25:28 - 00:01:29:05
text manipulation,
so with regex you can manipulate text

00:01:29:05 - 00:01:32:22
by replacing or modifying
specific patterns within a string.

00:01:33:05 - 00:01:38:07
This includes tasks like find and replace
operations, formatting

00:01:38:07 - 00:01:44:07
and reformatting text and transforming
data into the desired format.

00:01:44:18 - 00:01:48:11
You've got text parsing,
so Regexs is often used for passing

00:01:48:11 - 00:01:51:02
structured data from unstructured text

00:01:51:16 - 00:01:54:26
by refining regex patterns
to match specific

00:01:54:26 - 00:01:58:25
data patterns, you can extract meaningful
information from text such

00:01:58:25 - 00:02:03:29
as extracting dates, addresses
or other structured data.

00:02:03:29 - 00:02:06:07
And you've also got data
cleaning operations.

00:02:06:07 - 00:02:10:09
So regex is useful for data
cleaning tasks, such as removing

00:02:10:09 - 00:02:14:28
unnecessary characters, normalizing
data formats, removing duplicates

00:02:15:05 - 00:02:18:13
or correcting inconsistencies
in textual data.

00:02:19:26 - 00:02:22:27
So regex provides
a versatile and flexible way

00:02:22:27 - 00:02:26:26
to perform complex, complex
text manipulation tasks.

00:02:27:13 - 00:02:30:24
By mastering regex or learning
how to utilize regex,

00:02:30:24 - 00:02:35:04
You can efficiently search, validate and
manipulate text based on specific patents,

00:02:35:05 - 00:02:40:08
making it a valuable tool for various
programing and text processing operations.

00:02:41:04 - 00:02:45:02
Now, regex is not something that specific
to Infigo so there are loads of internet

00:02:45:02 - 00:02:49:04
resources available to assist you
with the creation of expression.

00:02:51:04 - 00:02:53:27
What I'm going to talk about here
is how we've incorporated

00:02:53:27 - 00:02:58:19
this regex functionality
into in Infigo Invent.

00:02:58:19 - 00:03:03:04
So the example I'm

00:03:03:04 - 00:03:06:21
going to utilize
here is the formatting of a phone number.

00:03:07:02 - 00:03:10:24
So in my example,
I have a basic business card,

00:03:10:24 - 00:03:13:17
but on the back of that business card
we have a telephone number.

00:03:14:06 - 00:03:17:13
And what we might want to make sure
is that all every telephone number

00:03:17:13 - 00:03:21:12
that's input
is put into a consistent format.

00:03:21:12 - 00:03:25:01
And this is just one of the many
potential applications for regex.

00:03:26:02 - 00:03:28:20
How we would actually set that up
within Invent itself

00:03:29:07 - 00:03:31:28
is within a variable itself.

00:03:33:05 - 00:03:35:07
So if I create a new variable

00:03:35:07 - 00:03:40:11
within Invent, I could say add variable

00:03:41:15 - 00:03:43:17
and then choose a text variable.

00:03:45:06 - 00:03:48:03
In my example, I'm just going to edit
my existing variable

00:03:48:03 - 00:03:53:15
that I've created again
into the text variable type.

00:03:53:15 - 00:03:57:15
And then what you'll find on the bottom
left of this screen that pops up

00:03:57:24 - 00:04:00:02
is Regexs text manipulation.

00:04:00:16 - 00:04:04:21
And this gives you the ability to so it's
between a few predefined expressions

00:04:05:01 - 00:04:07:19
or you can generate your own expression

00:04:08:06 - 00:04:11:22
if you've got the ability to do so.

00:04:11:22 - 00:04:15:08
So we've got regex text manipulation,
which is showing you the applied rules

00:04:16:11 - 00:04:19:21
and we've got a series of predefined
default manipulations.

00:04:20:09 - 00:04:24:12
All of this stage is picked
the length of the phone number

00:04:24:12 - 00:04:29:05
I'm expecting click add
and then I will add it to the existing

00:04:29:05 - 00:04:36:07
regex text manipulations
that will be applied to that variable.

00:04:36:07 - 00:04:38:17
Now you don't have to stick
with the default formats.

00:04:38:17 - 00:04:41:07
If you want to tweak it slightly,
you can just click on edit

00:04:41:18 - 00:04:44:12
and that will take you
to this additional screen where you can

00:04:44:12 - 00:04:50:25
modify and tweak those expressions
slightly.

00:04:50:25 - 00:04:54:27
In addition, if you want to add your own
regex text manipulation expression,

00:04:55:06 - 00:04:58:14
you can click on Add
a regex text manipulation at the bottom

00:04:58:26 - 00:05:07:18
where you can define
your own string for use.

00:05:07:18 - 00:05:10:03
So what I've selected
here is the ten digit phone number,

00:05:10:12 - 00:05:14:11
and then just as my default value,
just as a point of reference, I've put in

00:05:14:22 - 00:05:18:15
ten digits, which will in this case
represent our telephone number.

00:05:19:17 - 00:05:19:27
And then I'm

00:05:19:27 - 00:05:22:23
going to click on Save from the Bottom
right to save the variable

00:05:23:19 - 00:05:26:28
and then just make sure that you've linked
that variable to the relevant

00:05:27:20 - 00:05:36:23
frame on your artwork itself.

00:05:36:23 - 00:05:39:23
Now, all I've done at this stage and I'm
going to set these steps as covered

00:05:39:23 - 00:05:42:25
in different
tutorials, is export that template

00:05:43:02 - 00:05:46:03
and then import it back into MegaEdit
and launch

00:05:46:04 - 00:05:47:07
the MegaEdit editor.

00:05:48:15 - 00:05:51:16
And then what we'll see in here
once we launch this is over on the right

00:05:51:16 - 00:05:52:01
hand side.

00:05:52:01 - 00:05:55:29
I have my text inputs
with my telephone number,

00:05:56:27 - 00:05:59:25
but then if I look at it
on the actual artwork itself,

00:05:59:25 - 00:06:03:21
we can see that those regex text
manipulation

00:06:03:21 - 00:06:06:19
expressions have been applied to that
telephone number.

00:06:07:04 - 00:06:09:24
So it's reformatted
completely from what I've entered here

00:06:10:01 - 00:06:15:05
into our desired format.

00:06:15:05 - 00:06:17:07
You can see
if I had more than ten characters,

00:06:17:07 - 00:06:21:07
it reverts because it's only
about the ten character limit.

00:06:21:07 - 00:06:30:10
Or if I change some of the characters,
it will format it in the same way.

00:06:31:05 - 00:06:35:16
So that's a very basic example
of how we could utilize regex expressions.

00:06:35:25 - 00:06:39:04
As I mentioned, the possibilities
are much, much greater with this,

00:06:39:21 - 00:06:43:20
and there's plenty of Internet
resources to assist you in that task.

 

Incomplete
No walkthrough guide is currently available