Matching substring

M

m

Hi All

I have a string :

invokeEvent('5_290_act', true)" class="button">Add</button>

I need to get 5_290_act into a variable, can you please tell me how to
construct regular expression for this.

Thanks
M
 
M

Martijn Lievaart

Hi All

I have a string :

invokeEvent('5_290_act', true)" class="button">Add</button>

I need to get 5_290_act into a variable, can you please tell me how to
construct regular expression for this.

Thanks
M

if (/invokeEvent\('(.*?)', true\)" class="button">Add</button>/) {
$var = $1;
}

HTH,
M4
 
T

Tad McClellan

m said:
I have a string :

invokeEvent('5_290_act', true)" class="button">Add</button>


I'll assume the string is in the $_ variable.

I need to get 5_290_act into a variable, can you please tell me how to
construct regular expression for this.


my($var) = /(\d\w+)/;
 
D

Dr.Ruud

m schreef:
I have a string :
invokeEvent('5_290_act', true)" class="button">Add</button>
I need to get 5_290_act into a variable, can you please tell me how to
construct regular expression for this.

perl -Mstrict -wle'
my $string = qq{invokeEvent("5_290_act", true)"
class="button">Add</button>};
my ($variable) = $string =~ m/(5_290_act)/;
print $variable;
'
5_290_act
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,206
Messages
2,571,069
Members
47,677
Latest member
MoisesKoeh

Latest Threads

Top