Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #15983
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Joshua Cranmer <Pidgeot18@verizon.invalid> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: need regular expression to replace part of result based on a search pattern |
| Date | Thu, 12 Jul 2012 11:42:20 -0400 |
| Organization | A noiseless patient Spider |
| Lines | 17 |
| Message-ID | <jtmr91$iek$1@dont-email.me> (permalink) |
| References | <6aefda61-b66a-4e8f-8634-ef6a95f79c4d@googlegroups.com> <f92af690-9380-4885-9955-ff9b536613d6@googlegroups.com> <jtmq79$bcf$1@dont-email.me> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Thu, 12 Jul 2012 15:42:25 +0000 (UTC) |
| Injection-Info | mx04.eternal-september.org; posting-host="b6119690a9a5ab373b731f76a77390d2"; logging-data="18900"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19jzrOXP88R/nW3lJYNXEYaDiScAwV/j2Y=" |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 |
| In-Reply-To | <jtmq79$bcf$1@dont-email.me> |
| Cancel-Lock | sha1:kB15ZLHat4DpSyVwTaqWjaSwM3o= |
| Xref | csiph.com comp.lang.java.programmer:15983 |
Show key headers only | View raw
On 7/12/2012 11:24 AM, Eric Sosman wrote:
> If quoted material can contain commas that don't count as field
> separators, I don't think regular expressions can do the job at all.
> You'll need to parse the strings in a context-sensitive way.
((?:[^,]*|'[^']*'),){5}
If you can have escapes, your string quote portion becomes:
'([^\\']|\\.)' (not including escape characters you need to represent
this is a Java string literal). It's doable, but building this sort of
stuff gets very ugly very quickly.
--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
need regular expression to replace part of result based on a search pattern Jimmy <jimmy_please@yahoo.com> - 2012-07-11 10:35 -0700
Re: need regular expression to replace part of result based on a search pattern Roedy Green <see_website@mindprod.com.invalid> - 2012-07-11 15:24 -0700
Re: need regular expression to replace part of result based on a search pattern Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2012-07-11 15:40 -0700
Re: need regular expression to replace part of result based on a search pattern Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2012-07-12 00:56 +0200
Re: need regular expression to replace part of result based on a search pattern Roedy Green <see_website@mindprod.com.invalid> - 2012-07-11 21:21 -0700
Re: need regular expression to replace part of result based on a search pattern Jimmy <jimmy_please@yahoo.com> - 2012-07-12 07:28 -0700
Re: need regular expression to replace part of result based on a search pattern Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-07-12 11:24 -0400
Re: need regular expression to replace part of result based on a search pattern Joshua Cranmer <Pidgeot18@verizon.invalid> - 2012-07-12 11:42 -0400
Re: need regular expression to replace part of result based on a search pattern Arne Vajhøj <arne@vajhoej.dk> - 2012-07-23 22:55 -0400
Re: need regular expression to replace part of result based on a search pattern Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-07-12 09:42 -0500
Re: need regular expression to replace part of result based on a search pattern Gene Wirchenko <genew@ocis.net> - 2012-07-12 09:18 -0700
Re: need regular expression to replace part of result based on a search pattern glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-07-12 18:34 +0000
Re: need regular expression to replace part of result based on a search pattern Arne Vajhøj <arne@vajhoej.dk> - 2012-07-23 22:53 -0400
Re: need regular expression to replace part of result based on a search pattern Arne Vajhøj <arne@vajhoej.dk> - 2012-07-23 22:48 -0400
Re: need regular expression to replace part of result based on a search pattern Arne Vajhøj <arne@vajhoej.dk> - 2012-07-25 17:37 -0400
csiph-web