Re: regexprep wildcard problem



In article <fn8fau$2u3$1@xxxxxxxxxxxxxxxxxx>,
per isakson <poi.nospam@xxxxxxxxxxxxxxx> wrote:
"Christian Kuijlaars" <c.a.j.kuijlaars@xxxxxxxxxxxxxxxxxx>
wrote in message <fn6us9$5fa$1@xxxxxxxxxxxxxxxxxx>...
I have the string 'atp[c]' which needs to be transformed
into 'atp', the same counts for 'atp[p]'.

regexprep({'atp[c]','atp[p]'}, '\[.\]', '')
ans =
'atp' 'atp'

This will work for any one character inbetween square
brackets. / per

Unfortunately it will also transform 'a[c]t[p]' to 'at' --
the pattern isn't anchored to only match terminal \[.\]
It will also do strange things to a[[]]tp

--
We regret to announce that sub-millibarn resolution bio-hyperdimensional
plasmatic space polyimaging has been delayed until the release
of Windows Vista SP2.
.



Relevant Pages

  • Re: Is this C program doing what it is supposed to do ?
    ... Richard started by boiling it down to single letter names. ... advocating against the pattern itself, ... Even inside brackets, it becomes an eysore in some cases: ...
    (comp.lang.c)
  • Re: RegEx
    ... This works for me but if there is a more compact definition, ... your current pattern will match only cases where all the table ... names are in brackets or none of them are. ... and table names that have mixed bracket/no bracket formats: ...
    (microsoft.public.scripting.vbscript)
  • Re: Error in RowFilter Like Operation
    ... characters should be escaped in brackets. ... a pattern, or at the end of a pattern, or at the beginning of a ... "ItemName LIKE '*product'" ... Wildcards are not allowed in the middle of a string. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: RegEx
    ... This works for me but if there is a more compact definition, ... your current pattern will match only cases where all the table ... names are in brackets or none of them are. ... and table names that have mixed bracket/no bracket formats: ...
    (microsoft.public.scripting.vbscript)
  • Re: Question on tiebreaks
    ... 10-8 in tiebreak against Ljubicic at US Open in 2003, ... Is this a mistake from ATP or what? ... The loser's score should go in brackets. ...
    (rec.sport.tennis)