Job Management Partner 1/Integrated Management - Manager Overview and System Design Guide

[Contents][Glossary][Index][Back][Next]


Appendix G.5 Examples of using regular expressions

The table below describes examples of using regular expressions.

Table G-3 Examples of using regular expressions

Expression Meaning String specified as a regular expression Example pattern Match (Y)
or No match (N)
string Matches lines containing the specified string. spring spring has come. Y
winter-summer-autumn-spring Y
-----spring----- Y
^string Matches the specified string at the beginning of a line. ^spring spring has come. Y
winter-summer-autumn-spring N
-----spring----- N
string$ Matches the specified string at the end of a line. spring$ spring has come. N
winter-summer-autumn-spring Y
-----spring----- N
^string$ Matches lines containing only the specified string. ^spring$ spring has come. N
winter-summer-autumn-spring N
spring Y
[Figure]spring N
^$ Matches empty lines. ^$ [Figure] Y
spring N
. (period) Matches any single character. in.e winter has come. Y
mother of invention Y
life is in everything Y
eight nine ten N
increasing population N
s..ing picnic in spring Y
skiing in winter Y
[string]#1,#2 Matches any character specified in the string enclosed in square brackets. [pr] spring has come. Y
today is monday. N
[char-char]#1,#2 Matches any character in the range, in ascending order of the character codes. [a-i] spring has come. Y
[^char-char]#1,#2 Matches any character not in the specified range, in ascending order of the character codes. [^a-i] spring has come. Y
char* Matches strings of zero or more occurrences of the preceding character. ro*m terminal Y
cd-rom Y
living room Y
h.*n This is a pen. Y
That is an apple. Y
regex|regex#1,#2 Matches either regular expression. [0-9]+|apple That is an apple. Y
spring in 2003 Y
\special-char#1,#2 Handles the special character as an ordinary character. o\.h <stdio.h> Y
another man N
(regex)#1,#2 Groups a regular expression.
Used to explicitly indicate to the program that the specified characters are a regular expression.
Used mainly with a vertical bar (|). (See G.4 Tips on using regular expressions.)
i(n.e|ng) winter has come. Y
interesting book Y

Legend:
Bold type: String matching the specified regular expression.
Y: The example pattern is a match.
N: The example pattern is not a match.

#1: Cannot be specified as a JP1-specific regular expression.

#2: Cannot be specified as a basic XPG4 regular expression.


[Contents][Back][Next]


[Trademarks]

All Rights Reserved. Copyright (C) 2009, Hitachi, Ltd.