perlquestion
newbio
Hello Monks,
<p><p>
Example:
<p><p>
Input: **Type_1_deiodinase** , **D1** , metabolizes different forms, **A** , **B** of thyroid hormones to control levels of T3 , the active ligand for **thyroid_hormone_receptors** , **TR**
<p><p>
Output: **Type_1_deiodinase_(D1)** metabolizes different forms, **A_(B)** of thyroid hormones to control levels of T3 , the active ligand for **thyroid_hormone_receptors_(TR)**
<p><p>
If I do the following: <code> $line =~ s/\*\*([^\*]+)\*\*\s\,\s\*\*([^\*]+)\*\*(\s\,)?/**$1_($2)**/g;</code>
<p><p>
it merges all $1 and $2 in the sentence. However, I want to merge terms only if either of $1 or $2 contains '_'.
<p><p>
That is in the above sentence, **Type_1_deiodinase_(D1)** and **thyroid_hormone_receptors_(TR)** are OK, while **A_(B)** is not. Is there a way to apply 'if' condition in the substitution expression above so that I can merge only those adjacent terms that contain '_'?
<p><p>
Thanks a lot.