![]() |
RegEx REPLACEMENT: Help needed!
Does anyone now which is the notation for the replacement operator?
%1 and $1 do not seem to work I want this: Code:
<div class="s5" id="calibre_toc_2">Code:
<div class="s5" id="calibre_toc_2">Code:
<div class="s5" id="calibre_toc_[0-9]">\n\s*<p class="calibre2">([\(\Ñ\).a-zA-Z0-9\-_\s\c]*)</p> |
It's \#.
I really need to write a wiki page for the regex syntax... but I'm slightly reluctant since I'll probably be replacing the currently used engine with PCRE. Anyway, you can see the upstream documentation on the regex engine that Sigil uses here. |
I read the link before and as far as I remember
there is no reference to \# nor replace. ¿could you please use it in the example I'm working on? I cannot make it work EDIT: No need to. I've figured out myself. Odd notation though. Thanks anyway. |
I think it means using \1, \2, etc. instead of %1 or $2...
|
Quote:
|
Quote:
I mean, I know why I care about it, but I'm interested in why are you so excited about the prospect. Knowing the reason would give me more perspective. |
Quote:
The universe is kind today! m a r ps: I'm a NoteTab dork, and it uses PCRE. |
Well, I suppose you are thinking on development issues but I've consulted the Wiki comparison between RegeX ENGINES and Qt seemed to be the less powerful and flexible:
http://en.wikipedia.org/wiki/Compari...ession_engines Anyway it has done the job perfectly after the initial surprise because of the non-standard (if there is such thing as a standard for RegEx) notation. |
Quote:
I'm also fairly sure PCRE will be much faster. I'll have to profile that to be sure, but I have a feeling. Quote:
When I get around to creating an options screen, I might make it user-selectable. |
Quote:
Now that I've you on the line, lets talk about SIGIL "philosophy": I've been thinking about what you said about the program sticking to the "Editor" tool concept. Let say that the program has now 2 clear edition "layers": - One "high level", user friendly, WYSISWYG related layer. - Other "low level" advanced user, CODE related layer. Perhaps the program will become an original & powerful tool if it develops functionalities in an in-between "layer". For example: beign able to manage a library of personal CSS styles to apply them over existing CSS styles generated by conversion software. |
Quote:
(I just realized that "PCRE regex" is a bit redundant) |
Quote:
|
just, FYI, their is a link to a regex tutorial for python (but including references to other flavors of regex expressions) under software called REGEX BUDDY. While it is a little steep for the average newbie, someone with programming experience should be able to handle it pretty well.
I cannot remember the exact name of the site, thus the indirect reference. |
| All times are GMT -4. The time now is 06:44 PM. |
Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.