Showing posts with label string. Show all posts
Showing posts with label string. Show all posts
Tuesday, 6 March 2018
StringSearcher
To split a string into its components using Regular Expressions, you can use the StringSearcher transformer. In the [Contains Regular Expression] field, put parentheses around each group; and in the [Subexpression Matches List Name] field within the [Advanced] group, specify the name of the list that will contain the individual components.
See also https://www.safe.com/webinars/back-fme-school-day-1-data-fme/ at around 1:50:00
Monday, 26 February 2018
Regular Expressions (Regex)
(Note to self: use Word to update the tables)
Metacharacters are reserved characters, and they are:
To find a metacharacter in a string, prefix it with a backslash, e.g. \. to find a dot, or \\ to find a backslash.
See also https://www.regular-expressions.info/index.html
Metacharacters
Metacharacters are reserved characters, and they are:
{}[]()^$.|*+?-\
Find a character
a
|
a single character a
| |
[abc]
|
(a|b|c)
|
any single
character from the set, i.e. a, b, or c. For example, [bcr]at matches "bat",
"cat", and "rat"
|
[^abc]
|
any single
character except a, b, or c. For example, [^b]at matches "cat" and "rat", but not "bat"
| |
[A-Z]
|
any character in the range A-Z, i.e. any uppercase letter
| |
[a-z]
|
any character in the range a-z, i.e. any lowercase letter
| |
[A-Za-z]
|
any character in the range A-Z or a-z, i.e. any letter
| |
[0-9]
|
\d
|
any character in the range 0-9, i.e. any number
|
.
|
any single character
| |
\.
|
a dot (prefix with a backslash as . is a metacharacter)
| |
\\
|
a backslash character (prefix with a backslash as the backslash is a
metacharacter itself)
| |
\t
|
a tab character
| |
\n
|
a new line character (also see $ is the end of line expression)
| |
\s
|
any whitespace character, which includes space, tab and newline
character
| |
\w
|
[0-9a-zA-Z_]
|
any word character, which only includes any lowercase or
uppercase letter, any number and the underscore character
|
\d
|
any digit
| |
(a|b)
|
a or b
|
Line Characters
^
|
start of line
|
$
|
end of line
|
^$
|
empty string = ""
|
Quantification
a?
|
0 or 1 of a. For example, colou?r matches both "color" and
"colour"
|
a*
|
0 or more of a. For example, ab*c matches "ac", "abc",
"abbc", "abbbc",
and so on
|
a+
|
1 or more of a. For example, ab+c matches "abc", "abbc", "abbbc",
and so on, but not "ac"
|
a{3}
|
exactly 3 of a
|
a{3,}
|
3 or more of a
|
a{3,6}
|
between 3 and 6 of a
|
Grouping
( )
|
capture group
|
\1
|
backreference to group #1
|
See also https://www.regular-expressions.info/index.html
Finding and replacing text
- To find substrings, use the StringSearcher transformer or the @FindString or @FindRegEx built-in functions
- To replace substrings, use the StringReplacer transformer or the @ReplaceString or@ReplaceRegEx built-in functions
Subscribe to:
Posts (Atom)
Combine Raster Bands
To combine multiple single-band rasters into a single multi-band raster, use the RasterBandCombiner transformer. For example, combine the ...
-
To find substrings, use the StringSearcher transformer or the @FindString or @FindRegEx built-in functions To replace substrings, use the...
-
To split a string into its components using Regular Expressions, you can use the StringSearcher transformer. In the [Contains Regular Expre...
-
To convert a String attribute containing a date or time text to a Date/Time attribute, use the @DateTimeParse built-in function. To autom...