Positional operators at regexprep

John W. Eaton jwe at bevo.che.wisc.edu
Tue Dec 4 11:46:21 CST 2007


On 27-Nov-2007, KalleWirsch wrote:

| 
| Hi,
| excuse me for my badly englisch.
| 
| At Matlab positional operators are defined as follows 
|  "Positional operators in an expression match parts of the input string
| not by content, but by where they occur in the string (e.g., the first N
| characters
| in the string).
| \<expr
| Match expr when it occurs at the beginning of a word.
| expr\>
| Match expr when it occurs at the end of a word.
| 
| I have a problem with the characters \< \> because octave don't recognize # 
| inside \< \>.
| For example in octave I worked with ...
| str = 'My flowers #may bloom in May';  Character "#" is important in my
| case. Octave can't process with it in this context
| pat = '\<#may\>';
| regexprep(str, pat, 'April')
| 
| Octave afford the following result... ans = My flowers #may bloom in May. 
| Well it's wrong i want to get this result... ans = My flowers April bloom in
| May. 
| 
| Have anyone an idea because of my problem with \<# \>
| I hope you can understand my question.

It looks like a missing feature to me.  Maybe someone would like to
submit a patch?

jwe


More information about the Help-octave mailing list