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


Groups > comp.lang.java.programmer > #10217 > unrolled thread

search replace with regex

Started byRoedy Green <see_website@mindprod.com.invalid>
First post2011-11-25 00:17 -0800
Last post2011-12-13 07:55 -0800
Articles 8 — 7 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  search replace with regex Roedy Green <see_website@mindprod.com.invalid> - 2011-11-25 00:17 -0800
    Re: search replace with regex Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-11-25 07:24 -0400
      Re: search replace with regex Roedy Green <see_website@mindprod.com.invalid> - 2011-11-25 13:46 -0800
        Re: search replace with regex Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-11-26 15:24 -0800
        Re: search replace with regex bugbear <bugbear@trim_papermule.co.uk_trim> - 2011-12-13 09:29 +0000
    Re: search replace with regex Arne Vajhøj <arne@vajhoej.dk> - 2011-11-25 17:09 -0500
      Re: search replace with regex JussiJ <jussij@zeusedit.com> - 2011-12-12 20:15 -0800
        Re: search replace with regex Lew <lewbloch@gmail.com> - 2011-12-13 07:55 -0800

#10217 — search replace with regex

FromRoedy Green <see_website@mindprod.com.invalid>
Date2011-11-25 00:17 -0800
Subjectsearch replace with regex
Message-ID<ajjuc752tol3mcbrnlmlup7l5a29aadnuu@4ax.com>
I have been using Funduc Search/Replace with works command line, as a
gui, and with scripts to do multiple search-replaces on multiple
files.

It work fine, except it uses a proprietary regex quite different from
Java Regex.  I would like something just like it, but that use Java
Regex. I have unsuccessfully tried to talk the authors into supporting
Java syntax.

see http://mindprod.com/jgloss/searchreplace.html
to see what I mean.

I have not found anything suitable is a short google search.  On my
todo  list is to write one. What do you use?
-- 
Roedy Green Canadian Mind Products
http://mindprod.com
I can't come to bed just yet. Somebody is wrong on the Internet. 

[toc] | [next] | [standalone]


#10221

FromArved Sandstrom <asandstrom3minus1@eastlink.ca>
Date2011-11-25 07:24 -0400
Message-ID<lVKzq.74340$SW4.56763@newsfe08.iad>
In reply to#10217
On 11-11-25 04:17 AM, Roedy Green wrote:
> I have been using Funduc Search/Replace with works command line, as a
> gui, and with scripts to do multiple search-replaces on multiple
> files.
> 
> It work fine, except it uses a proprietary regex quite different from
> Java Regex.  I would like something just like it, but that use Java
> Regex. I have unsuccessfully tried to talk the authors into supporting
> Java syntax.
> 
> see http://mindprod.com/jgloss/searchreplace.html
> to see what I mean.
> 
> I have not found anything suitable is a short google search.  On my
> todo  list is to write one. What do you use?

On Windows I use Notepad++ or Powershell for the general case (where
it's _not_ source code in an IDE).

AHS

[toc] | [prev] | [next] | [standalone]


#10240

FromRoedy Green <see_website@mindprod.com.invalid>
Date2011-11-25 13:46 -0800
Message-ID<mi20d7dt3qgn4mbdahl3gt0dgo7lkr5f6f@4ax.com>
In reply to#10221
On Fri, 25 Nov 2011 07:24:00 -0400, Arved Sandstrom
<asandstrom3minus1@eastlink.ca> wrote, quoted or indirectly quoted
someone who said :

>
>On Windows I use Notepad++ or Powershell for the general case (where
>it's _not_ source code in an IDE).

For source code IntelliJ has Java regexes built into the IDE is a
quite convenient way.  The problem mostly is scanning content for the
website which is mostly HTML or embedded macros to do bulk changes.

For this I need something quite quick with the ability to handle
multiple files and multiple regexes per pass. 

I will have a look for PowerShell.

If I write my own, I will build in a regex proofreader than lets you
see by colour which chars are being taken literally and which as
commands. It could also make sure () [] balance etc.

It has also dawned on me that XML is a quite reasonable language to
define scripts.  You can create it with a gui.  You can play with in
with XML tools safely. You can edit it externally. It already has a
mechanisms for comments, handling awkward characters and treating
multiple spaces as significant.  It is easy for others to generate
with custom apps since they can avoid dealing with some of the messy
details.

-- 
Roedy Green Canadian Mind Products
http://mindprod.com
I can't come to bed just yet. Somebody is wrong on the Internet. 

[toc] | [prev] | [next] | [standalone]


#10270

FromDaniel Pitts <newsgroup.nospam@virtualinfinity.net>
Date2011-11-26 15:24 -0800
Message-ID<dzeAq.35609$t37.5110@newsfe14.iad>
In reply to#10240
On 11/25/11 1:46 PM, Roedy Green wrote:
> On Fri, 25 Nov 2011 07:24:00 -0400, Arved Sandstrom
> <asandstrom3minus1@eastlink.ca>  wrote, quoted or indirectly quoted
> someone who said :
>
>>
>> On Windows I use Notepad++ or Powershell for the general case (where
>> it's _not_ source code in an IDE).
>
> For source code IntelliJ has Java regexes built into the IDE is a
> quite convenient way.  The problem mostly is scanning content for the
> website which is mostly HTML or embedded macros to do bulk changes.
IntelliJ has quite a nice HTML/XML editor as well, and its regex support 
works on those file types without any stretched imagination.
>
> For this I need something quite quick with the ability to handle
> multiple files and multiple regexes per pass.
Are you talking about from a command line? I tend to use "sed" for such 
tasks, but does not have Java syntax either.  Not sure why you would 
force it too.
>
> I will have a look for PowerShell.
>
> If I write my own, I will build in a regex proofreader than lets you
> see by colour which chars are being taken literally and which as
> commands. It could also make sure () [] balance etc.
The latest IntelliJ has a very nice regex editor.

>
> It has also dawned on me that XML is a quite reasonable language to
> define scripts.  You can create it with a gui.  You can play with in
> with XML tools safely. You can edit it externally. It already has a
> mechanisms for comments, handling awkward characters and treating
> multiple spaces as significant.  It is easy for others to generate
> with custom apps since they can avoid dealing with some of the messy
> details.

XML is quite a reasonable syntax for expressing trees. That doesn't make 
it a "good" language to define scripts.
    (a) It's not a language, but a markup syntax.
    (b) It's often too verbose for "scripts".
    (c) While it may seem nice to play/edit/inspect with existing tools,
        creating a tool which reads XML and performs commands is a bit
        of work.  Surprisingly not much less complicated than a real
        compiler/interpreter.
    (d) ant does exactly what I'm saying isn't a good idea ;-)


--
Daniel.

[toc] | [prev] | [next] | [standalone]


#10695

Frombugbear <bugbear@trim_papermule.co.uk_trim>
Date2011-12-13 09:29 +0000
Message-ID<cY6dnXMecuFih3rTnZ2dnUVZ7qydnZ2d@brightview.co.uk>
In reply to#10240
Roedy Green wrote:

>
> It has also dawned on me that XML is a quite reasonable language to
> define scripts.  You can create it with a gui.  You can play with in
> with XML tools safely. You can edit it externally. It already has a
> mechanisms for comments, handling awkward characters and treating
> multiple spaces as significant.  It is easy for others to generate
> with custom apps since they can avoid dealing with some of the messy
> details.

If most of the files you wish to manipulate are XML,
XML is a lousy language to define the manipulation in.

You end up needing to escape everything.

  BugBear

[toc] | [prev] | [next] | [standalone]


#10242

FromArne Vajhøj <arne@vajhoej.dk>
Date2011-11-25 17:09 -0500
Message-ID<4ed01237$0$290$14726298@news.sunsite.dk>
In reply to#10217
On 11/25/2011 3:17 AM, Roedy Green wrote:
> I have been using Funduc Search/Replace with works command line, as a
> gui, and with scripts to do multiple search-replaces on multiple
> files.
>
> It work fine, except it uses a proprietary regex quite different from
> Java Regex.  I would like something just like it, but that use Java
> Regex. I have unsuccessfully tried to talk the authors into supporting
> Java syntax.
>
> see http://mindprod.com/jgloss/searchreplace.html
> to see what I mean.
>
> I have not found anything suitable is a short google search.  On my
> todo  list is to write one. What do you use?

If you write something in Java, then you will get Java syntax.

But Java is not special - Java uses standard Perl syntax - and
I would expect there to be utilities that use Perl syntax.

Otherwise then maybe write one in Perl! :-)

Arne


[toc] | [prev] | [next] | [standalone]


#10689

FromJussiJ <jussij@zeusedit.com>
Date2011-12-12 20:15 -0800
Message-ID<5a4b3271-297a-4227-aed3-0f927c9b4f78@b14g2000prn.googlegroups.com>
In reply to#10242
On Nov 26, 9:09 am, Arne Vajhøj <a...@vajhoej.dk> wrote:

> But Java is not special - Java uses standard Perl syntax - and
> I would expect there to be utilities that use Perl syntax.

FWIW the Zeus for Windows IDE has support for Java and it
also has Perl syntax search and replace:

   http://www.zeusedit.com

[toc] | [prev] | [next] | [standalone]


#10705

FromLew <lewbloch@gmail.com>
Date2011-12-13 07:55 -0800
Message-ID<27315093.2875.1323791718133.JavaMail.geo-discussion-forums@prcx11>
In reply to#10689
JussiJ wrote:
> Arne Vajhøj wrote:
>> But Java is not special - Java uses standard Perl syntax - and
>> I would expect there to be utilities that use Perl syntax.
> 
> FWIW the Zeus for Windows IDE has support for Java and it
> also has Perl syntax search and replace:

The question of whether an IDE supports "Perl syntax search and replace" does not impinge on the target language's regular-expression capabilities.

-- 
Lew

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web