ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

WildOpal - hypothetical new idea for a "find and replace" program

<< < (2/7) > >>

Twinbee:
Thanks everyone for all for the feedback.

Regex has this big problem in that you can't allow a section of text to be treated as 'non-special'. I had some text I wanted to operate on that lots of symbols. Unfortunately, it would have meant I had to escape each and every one - not my idea of fun, especially since special symbols apparently differ according to the Regex implementation.

I know Regex has got a lot of momentum now, but I can't help feeling there are fundamental advantages to this kind of approach offered by WildOpal (as well as possible small disadvantages I admit, such as extra developer effort). For beginners, or the non-techy minded at least, it should be an improvement I think, but even seasoned users should find an improvement in theory, at least in certain ways.

For example, it's clearer for somebody else who didn't create the original expression to read it more easily.

wraith808:
It's merely a matter of finding out how to do it in most cases with RegEx, rather than it not having the capability.

Case in point:

Many flavors also support the \Q…\E escape sequence. All the characters between the \Q and the \E are interpreted as literal characters. E.g. \Q*\d+*\E matches the literal text *\d+*. The \E may be omitted at the end of the regex, so \Q*\d+* is the same as \Q*\d+*\E. This syntax is supported by the JGsoft engine, Perl, PCRE, PHP, Delphi, and Java, both inside and outside character classes. Java 4 and 5 have bugs that cause \Q…\E to misbehave, however, so you shouldn't use this syntax with Java.

--- End quote ---

From http://www.regular-expressions.info/characters.html

If it's just for one application, what you're proposing would have less of an uphill battle, I think.  You're proposing not just a software tool, but a standard to be used in searching.  Unless your hypothetical program was an editor also.

Twinbee:
wraith808: Shame it isn't fully standard in the spec, but crumbs, you're right - the \Q...\E does indeed work to treat chars as literal, at least in Notepad++. Asking at SuperUser.com produced no response, and it was missing from practically all of the tutorials I saw from searching with Google, so I assumed it was impossible.

It's going to be a lot easier to create this hypothetical program than I anticipated, since I thought of the (now obvious) idea to use Regex as a middleman. My program simply becomes a sugary wrapper for Regex. Things like ".+?" (without the quotes) can be replaced by that inverted star wildcard symbol for example. Other things like the newline symbol can represent "\r", "\r\n", or "\n" (with the option to use those specifically for more power if need be), and "[0-9]+" or "\d+" can be replaced with a single symbol.

I know they're little things, but it all helps, and can potentially reduce a complex expression to at least half its original size. Like a sugar-coated Regex.

You're proposing not just a software tool, but a standard to be used in searching
--- End quote ---

Yes, I think it would be neat to see something like this used everywhere, especially for people who don't use Regex very frequently, but obviously the chance of that is virtually zero. Maybe some people may find it useful though, so I'll persevere regardless.

wraith808:
Shame it isn't fully standard in the spec, but crumbs, you're right - the \Q...\E does indeed work to treat chars as literal, at least in Notepad++. Asking at SuperUser.com produced no response, and it was missing from practically all of the tutorials I saw from searching with Google, so I assumed it was impossible.
-Twinbee (May 25, 2015, 05:09 AM)
--- End quote ---

I've found that on the StackExchange sites with a high volume, valid questions can get lost in the noise... whether its from the time posted, how fast things scroll off the front page, or any variety of other reasons :(

Glad I could help, though!  And good luck with your program!

JavaJones:
Interesting discussion. As someone who has struggled with RegEx in the past but regularly uses simpler search operators and wildcards (e.g. *.jpg, *DCM_??, etc.) I might find this tool useful. Especially if it interfaces with/generates RegEx. It of course would need to do that if it has no built-in editor capability. If it did, it could get some use especially if it could be invoked easily through e.g. Notepad++ ("Open this file in WildOpal"). Generating RegEx would extend its reach quite a bit more.

Anyway, I find the idea appealing. And since you're already going forward with it, I am curious to see what you come up with.

- Oshyan

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version