in reply to Re: perl extraction from a file
in thread perl extraction from a file
Hi, Below code will work with or without attributes. Try this,
undef $/; $str =<DATA>; while ($str =~ /<([^\/ ]+) ?[^>]*>((?:(?!<\/\1>).)*)<\/\1>/gsi) { print "Data inside $1 tag:\t$2\n"; } __DATA__ <user_name type="new">$userId</user_name> <job_id>$jobId</job_id> <finish_time>$timeF$ampmF</finish_time> <status cate="true">COMPLETED</status>
Regards,
Velusamy R.
|
|---|