Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #11099

Re: Regex doesn't recognize single quote

From Arved Sandstrom <asandstrom3minus1@eastlink.ca>
Newsgroups comp.lang.java.programmer
Subject Re: Regex doesn't recognize single quote
References <74f4b448-24bf-448f-9f4a-06fd1b79c86d@o12g2000vbd.googlegroups.com> <prmfg79jlt8o86otpnabqfs924cc399var@4ax.com> <bloat-20120107123558@ram.dialup.fu-berlin.de> <1kihg7hn1rr434mlg5krkdpi1ef563cjd4@4ax.com>
Message-ID <xS5Oq.67743$_H.51387@newsfe16.iad> (permalink)
Organization Public Usenet Newsgroup Access
Date 2012-01-07 20:58 -0400

Show all headers | View raw


On 12-01-07 06:48 PM, Roedy Green wrote:
> On 7 Jan 2012 11:42:26 GMT, ram@zedat.fu-berlin.de (Stefan Ram) wrote,
> quoted or indirectly quoted someone who said :
> 
>>  How do you know what it is for?
> 
> I see what you mean.  I saw the problem as the pattern  translation of
> various characters to various other characters.  The problem is
> actually simpler than that.  It translates various different
> characters all to the same empty "character".
> 
> I find the replace methods dangerous. They are improperly named and
> thus it  is easy to accidentally use a regex or non-regex.  They also
> have to compile the pattern every time. I tend to avoid them.

The methods that accept 'char' or 'CharSequence" are named 'replace'.
The two methods that use regexes are called 'replaceAll' and
'replaceFirst'. I don't see a possibility of accidents here.

The methods are not remotely improperly named: they replace text. That
some of them use literals, and others use regular expressions, to
specify what text is to be replaced, does not alter that central fact.

AHS

-- 
...wherever the people are well informed they can be trusted with their
own government...
-- Thomas Jefferson, 1789

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Regex doesn't recognize single quote Jerric <jerricgao@gmail.com> - 2012-01-06 14:08 -0800
  Re: Regex doesn't recognize single quote Martin Gregorie <martin@address-in-sig.invalid> - 2012-01-06 22:23 +0000
  Re: Regex doesn't recognize single quote Jake Jarvis <pig_in_shoes@yahoo.com> - 2012-01-06 23:48 +0100
  Re: Regex doesn't recognize single quote Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-01-06 15:49 -0800
    Re: Regex doesn't recognize single quote Jim Janney <jjanney@shell.xmission.com> - 2012-01-07 19:02 -0700
      Re: Regex doesn't recognize single quote Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-01-09 09:58 -0800
  Re: Regex doesn't recognize single quote Roedy Green <see_website@mindprod.com.invalid> - 2012-01-06 21:47 -0800
    Re: Regex doesn't recognize single quote Roedy Green <see_website@mindprod.com.invalid> - 2012-01-07 14:41 -0800
      Re: Regex doesn't recognize single quote Rafael Villar <morgano5@hotmail.com> - 2012-01-08 09:05 +1000
        Re: Regex doesn't recognize single quote Rafael Villar <morgano5@hotmail.com> - 2012-01-08 09:10 +1000
        Re: Regex doesn't recognize single quote Lew <noone@lewscanon.com> - 2012-01-07 17:20 -0800
      Re: Regex doesn't recognize single quote Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-01-09 10:08 -0800
        Re: Regex doesn't recognize single quote Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-01-09 10:33 -0800
    Re: Regex doesn't recognize single quote Roedy Green <see_website@mindprod.com.invalid> - 2012-01-07 14:48 -0800
      Re: Regex doesn't recognize single quote Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-01-07 20:58 -0400

csiph-web