Support Support Downloads Knowledge Base Case Manager My Juniper Community

Knowledge Base

Search our Knowledge Base sites to find answers to your questions.

Ask All Knowledge Base Sites All Knowledge Base Sites JunosE Defect (KA)Knowledge BaseSecurity AdvisoriesTechnical BulletinsTechnotes Sign in to display secure content and recently viewed articles

CLI command to match string with a regular expression

0

0

Article ID: KB14514 KB Last Updated: 10 Jun 2010Version: 2.0
Summary:
IDP supports a command line utility to match a particular regular expression to a string.
Symptoms:


Solution:
IDP support a CLI command to verify if a string matches with a regular expression.   The command is:
dfa_test “REG-EXP” “STRING”

Command result provides if the string matched or not.

Example:

[root@defaulthost tmp]# dfa_test "\[Mozilla\]\/4\.0\s\(\[compatible\].*" "Mozilla/4.0 (compatible;"
fopen(/tmp/cfg/idp.cfg) failed [errno=2, No such file or directory]
sc_get_cfgfileval('/tmp/cfg/idp.cfg', 'global.user') failed
sc_sys_init: set uid/gid failed - ignoring...
pattern '\[Mozilla\]\/4\.0\s\(\[compatible\].*'

24 states
1 final states: 23

0 *(0)-L(76) 0
0 M(77) 1
0 N(78)-l(108) 0
0 m(109) 1
0 n(110)-*(255) 0
1 *(0)-N(78) 0
1 O(79) 2
1 P(80)-n(110) 0
1 o(111) 2
1 p(112)-*(255) 0
2 *(0)-Y(89) 0
2 Z(90) 3
2 [(91)-y(121) 0
2 z(122) 3
2 {(123)-*(255) 0
3 *(0)-H(72) 0
3 I(73) 4
3 J(74)-h(104) 0
3 i(105) 4
3 j(106)-*(255) 0
4 *(0)-K(75) 0
4 L(76) 5
4 M(77)-k(107) 0
4 l(108) 5
4 m(109)-*(255) 0
5 *(0)-K(75) 0
5 L(76) 6
5 M(77)-k(107) 0
5 l(108) 6
5 m(109)-*(255) 0
6 *(0)-@(64) 0
6 A(65) 7
6 B(66)-`(96) 0
6 a(97) 7
6 b(98)-*(255) 0
7 *(0)-.(46) 0
7 /(47) 8
7 0(48)-*(255) 0
8 *(0)-3(51) 0
8 4(52) 9
8 5(53)-*(255) 0
9 *(0)--(45) 0
9 .(46) 10
9 /(47)-*(255) 0
10 *(0)-/(47) 0
10 0(48) 11
10 1(49)-*(255) 0
11 *(0)-*(8) 0
11 *(9)-*(10) 12
11 *(11) 0
11 *(12)-*(13) 12
11 *(14)-*(31) 0
11 (32) 12
11 !(33)-*(255) 0
12 *(0)-'(39) 0
12 ((40) 13
12 )(41)-*(255) 0
13 *(0)-B(66) 0
13 C(67) 14
13 D(68)-b(98) 0
13 c(99) 14
13 d(100)-*(255) 0
14 *(0)-N(78) 0
14 O(79) 15
14 P(80)-n(110) 0
14 o(111) 15
14 p(112)-*(255) 0
15 *(0)-L(76) 0
15 M(77) 16
15 N(78)-l(108) 0
15 m(109) 16
15 n(110)-*(255) 0
16 *(0)-O(79) 0
16 P(80) 17
16 Q(81)-o(111) 0
16 p(112) 17
16 q(113)-*(255) 0
17 *(0)-@(64) 0
17 A(65) 18
17 B(66)-`(96) 0
17 a(97) 18
17 b(98)-*(255) 0
18 *(0)-S(83) 0
18 T(84) 19
18 U(85)-s(115) 0
18 t(116) 19
18 u(117)-*(255) 0
19 *(0)-H(72) 0
19 I(73) 20
19 J(74)-h(104) 0
19 i(105) 20
19 j(106)-*(255) 0
20 *(0)-A(65) 0
20 B(66) 21
20 C(67)-a(97) 0
20 b(98) 21
20 c(99)-*(255) 0
21 *(0)-K(75) 0
21 L(76) 22
21 M(77)-k(107) 0
21 l(108) 22
21 m(109)-*(255) 0
22 *(0)-D(68) 0
22 E(69) 23
22 F(70)-d(100) 0
22 e(101) 23
22 f(102)-*(255) 0
23 *(0)-*(255) 23

mozilla/4.0 (compatible: matched
[root@defaulthost tmp]#



In the example provided, ignore the error messages shown in the beginning. These error messages are always printed since the idp.cfg file is not required for the current command.   In the output, the final outcome of the comparison is shown at the end with the STRING and result of match (matched or not matched).

Comment on this article > Affected Products Browse the Knowledge Base for more articles related to these product categories. Select a category to begin.

Getting Up and Running with Junos

Getting Up and Running with Junos Security Alerts and Vulnerabilities Product Alerts and Software Release Notices Problem Report (PR) Search Tool EOL Notices and Bulletins JTAC User Guide Customer Care User Guide Pathfinder SRX High Availability Configurator SRX VPN Configurator Training Courses and Videos End User Licence Agreement Global Search