![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| convert phrase | fredao | Shell Programming and Scripting | 4 | 04-24-2008 11:34 AM |
| Dont Know How to Phrase the Title | barney34 | Shell Programming and Scripting | 1 | 12-12-2006 01:36 PM |
| Remove duplicate phrase | kesu2k | Shell Programming and Scripting | 6 | 10-17-2006 01:34 PM |
| if statement to match * | sivasenthil_k | UNIX for Dummies Questions & Answers | 3 | 09-20-2006 08:39 AM |
| Searching for a specific phrase on Unix server | mmcaleer | UNIX for Dummies Questions & Answers | 1 | 02-07-2005 01:18 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
match a phrase
Hi,
I have a these sentences. $sent1="Transactivation of wound-responsive genes containing the core sequence of the auxin-responsive element by a wound-induced protein kinase-activated transcription factor in tobacco plants."; $sent2="I branching formation in erythroid differentiation is regulated by transcription factor."; $query="transcription factor";(as a phrase) I want to match $query. I tried using regular expression but it is not working.I gave like this:- Code:
if($sent1=~/\b$query\b/i)
{
print "matched";
}
same way for sent2. but it is not matching. How to match this phrase? with regards vanitha |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
one way
Code:
if($sent1=~/$query/i)
{
print "matched";
}
|
|
#3
|
|||
|
|||
|
Hi, I tried it is matching.I tried highlighting the term "transcription factor" but it is not doing. Here is the code:- Code:
if($sent1=~/$query/i)
{
print "matched\n";
$sent1=~s/($query)/<spanstyle="background-color:#E1FF77">$1<\/span>/i;
print "<br>sentence1=$sent1<br>";
}
how to solve this? with regards Archana |
|
#4
|
|||
|
|||
|
what is not doing ? you can at least show your output.
I don't know, here's my simulation of your problem Code:
$sent1="Transactivation of wound-responsive genes containing the core sequence of the auxin-responsive element by a wound-induced protein kinase-activated transcription factor in tobacco plants.";
$sent2="I branching formation in erythroid differentiation is regulated by transcription factor.";
$query="transcription factor";
print "Original sent1: $sent1\n";;
if($sent1=~/$query/i)
{
print "matched\n";
$sent1=~s/($query)/<spanstyle="background-color:#E1FF77">$1<\/span>/i;
print "<br>sentence1=$sent1<br>";
}
Code:
# ./test1.pl Original sent1: Transactivation of wound-responsive genes containing the core sequence of the auxin-responsive element by a wound-induced protein kinase-activated transcription factor in tobacco plants. matched <br>sentence1=Transactivation of wound-responsive genes containing the core sequence of the auxin-responsive element by a wound-induced protein kinase-activated <spanstyle="background-color:#E1FF77">transcription factor</span> in tobacco plants.<br> # |
|
#5
|
|||
|
|||
|
Quote:
But on the browser the phrase "transcription factor" is not getting highlighted. here is th output Code:
Original sent1: Transactivation of wound-responsive genes containing the core sequence of the auxin-responsive element by a wound-induced protein kinase-activated transcription factor in tobacco plants. matched sentence1=Transactivation of wound-responsive genes containing the core sequence of the auxin-responsive element by a wound-induced protein kinase-activated transcription factor in tobacco plants. |
|||
| Google The UNIX and Linux Forums |