search replace with regex

R

Roedy Green

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?
 
A

Arved Sandstrom

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
 
R

Roedy Green

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.
 
A

Arne Vajhøj

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
 
D

Daniel Pitts

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 ;-)
 
L

Lew

JussiJ said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top