You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oro-user@jakarta.apache.org by "Max R. Andersen" <ma...@cs.auc.dk> on 2001/01/12 00:09:45 UTC

Problem with subsitiution...

I have this input:

*initial* 1. *first* 2. *second* 3. *third*

And this substitution pattern (in java-string-format):

s/([\\s^])\\*([^\\s].*?[^\\s])\\*([\\s\\,\\.\\;\\:\\!\\?\\$]|$)/$1<STRONG>$2<\\/STRONG>$3/g

The intention is to replace *something* with <STRONG>something</STRONG>,
but the result is:

*initial* 1. <strong>first</strong> 2. <strong>second</strong> 
3. <strong>third</strong>

Which is not the wanted result:

<strong>initial</strong> 1. <strong>first</strong>
2. <strong>second</strong>
3. <strong>third</strong>

Why does ([\\s^]) not match whitespace OR begining of line ?

Regards
Max R. Andersen (max@cs.auc.dk)