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


Groups > comp.lang.javascript > #15611

Re: regexp help needed

From Dr J R Stockton <reply1235@merlyn.demon.co.uk.invalid>
Newsgroups comp.lang.javascript
Subject Re: regexp help needed
Date 2012-08-29 19:16 +0100
Organization Home
Message-ID <QE9ropMyxlPQFwxP@invalid.uk.co.demon.merlyn.invalid> (permalink)
References <timstreater-EBD02F.15513028082012@news.individual.net>

Show all headers | View raw


In comp.lang.javascript message <timstreater-EBD02F.15513028082012@news.
individual.net>, Tue, 28 Aug 2012 15:51:30, Tim Streater
<timstreater@greenbee.net> posted:

>I try and avoid regexp as much as possible, but there are times when
>one such should represent a simple solution.

For string manipulation independent of numerical values, a RegExp
solution is commonly best; so an author should use RegExps wherever he
conveniently can.


>I have a string that may contain one or more single quotes, and for
>subsequent use of the string I want to escape these. So, if I have a
>string such as:


You know the answer.

But IMHO your first move should have been to use an entirely un-
contentious character, such as 5, instead of the quote, and test on such
as
        my cat5s name
to check whether there is something special about the quote character.

-- 
 (c) John Stockton, nr London, UK.  Mail via homepage.  Turnpike v6.05  MIME.
  Web  <http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms and links;
  Astro stuff via astron-1.htm, gravity0.htm ; quotings.htm, pascal.htm, etc.
 No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

regexp help needed Tim Streater <timstreater@greenbee.net> - 2012-08-28 15:51 +0100
  Re: regexp help needed Stefan Weiss <krewecherl@gmail.com> - 2012-08-28 17:32 +0200
    Re: regexp help needed Tim Streater <timstreater@greenbee.net> - 2012-08-28 16:41 +0100
    Re: regexp help needed Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-08-28 19:07 +0200
  Re: regexp help needed SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-08-28 19:54 +0200
  Re: regexp help needed Dr J R Stockton <reply1235@merlyn.demon.co.uk.invalid> - 2012-08-29 19:16 +0100
    Re: regexp help needed Tim Streater <timstreater@greenbee.net> - 2012-08-29 23:51 +0100
      Re: regexp help needed Dr J R Stockton <reply1235@merlyn.demon.co.uk.invalid> - 2012-08-31 23:04 +0100

csiph-web