Hi,
I have an array like this:
I have to highlight the word "RNA-binding protein" i have done using below statement and the output is in arr1
I want to match the sentences present in arr1 and arr2 if both are matching the arr2 should replace arr1 and rest print the contents.
Here is the code.
If the sentences are matching the highlighted sentence should be substituted in place of original sentence and i have to print the rest.
I tried like this but the last string is getting replaced and its not giving proper results.
How can i substitute the matched sentence with the original sentence and print the sentences??
Any suggestions?
with regards
Archana
I have an array like this:
Code:
@arr=("TDP-43 is a highly conserved, 43-kDa RNA-binding protein implicated to play a role in transcription repression, nuclear organization, and alternative splicing","More recently, this factor has been identified as the major disease protein of several neurodegenerative diseases","Our data further evidence TDP-43 as a multifunctional RNA-binding protein for a diverse set of cellular activities");
Code:
$str=~s/(\bRNA-binding protein\b)/<span style="background-color:#E1FF77">$1<\/span>/img;
@arr1=("TDP-43 is a highly conserved, 43-kDa RNA-binding protein implicated to play a role in transcription repression, nuclear organization, and alternative splicing","Our data further evidence TDP-43 as a multifunctional RNA-binding protein for a diverse set of cellular activities");
Here is the code.
Code:
foreach(@arr)
{
foreach $sent(@arr1)
{
if($_=~/$sent/ig)
{
$_=~s/$_/$sent/i;
}
}
print "<br> $_ <br>";
}
I tried like this but the last string is getting replaced and its not giving proper results.
How can i substitute the matched sentence with the original sentence and print the sentences??
Any suggestions?
with regards
Archana
Comment