cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
625
Views
5
Helpful
2
Replies

Find a word inside a string regex

Comm4nd0
Level 1
Level 1

Hi all,

having problems trying to find a word inside a string. the string is:

{"reload": "True"}

So i'm trying to regex for the word 'True', and store it in a variable like so.

action 6.4 regexp "True" "$_cli_result" reg_res

However, what is happening is the result of $reg_res is the entire line.

The reason why i only want the word True to be stored in the $reg_res variable is because the next line there is an IF statement to check it.

 

Many thanks in advance.

1 Accepted Solution

Accepted Solutions

Seb Rupik
VIP Alumni
VIP Alumni

Hi there,

Have you tried enclosing what you are trying to match in brackets?:

 

action 6.4 regexp "(True)" "$_cli_result" reg_res

cheers,

Seb.

View solution in original post

2 Replies 2

Seb Rupik
VIP Alumni
VIP Alumni

Hi there,

Have you tried enclosing what you are trying to match in brackets?:

 

action 6.4 regexp "(True)" "$_cli_result" reg_res

cheers,

Seb.

Legend, thank you!
Review Cisco Networking products for a $25 gift card