Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 07-08-2010, 02:07 PM   #1
troymc
Groupie
troymc will become famous soon enoughtroymc will become famous soon enoughtroymc will become famous soon enoughtroymc will become famous soon enoughtroymc will become famous soon enoughtroymc will become famous soon enough
 
Posts: 161
Karma: 608
Join Date: Aug 2008
Location: Plano, TX
Device: Sony PRS-505 + B&N Nook + Motion LE1700 + Motorola Xoom Wifi
Regex engine?

Anyone know what regex engine Sigil uses?

Most normal regexes seem to work but for some reason I can't get it to like '^' for start of line.

I think I need to go peruse the manual.


Troy
troymc is offline   Reply With Quote
Old 07-08-2010, 06:26 PM   #2
troymc
Groupie
troymc will become famous soon enoughtroymc will become famous soon enoughtroymc will become famous soon enoughtroymc will become famous soon enoughtroymc will become famous soon enoughtroymc will become famous soon enough
 
Posts: 161
Karma: 608
Join Date: Aug 2008
Location: Plano, TX
Device: Sony PRS-505 + B&N Nook + Motion LE1700 + Motorola Xoom Wifi
Ok, I really like the new manual. It told me exactly what I wanted to know.

Unfortunately it didn't get me what I wanted.

Sigil's manual basically states the same thing as the QRegExp doc does:
Quote:
In Sigil ^ always signifies the start of the string (apart from within character classes), so carets should be escaped unless used in this way. The same applies to $ which in Sigil always signifies the end of the string.
What does "string" mean in the context of a global S&R in Sigil?

Is it a line? In which case a ^ represents the start of the line.
Is it a file? In which case a ^ represents the start of the file.


Troy
troymc is offline   Reply With Quote
Advert
Old 07-08-2010, 06:59 PM   #3
capidamonte
Not who you think I am...
capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.
 
capidamonte's Avatar
 
Posts: 374
Karma: 30283
Join Date: Jan 2010
Location: Honolulu
Device: PocketBook 360 -- Ivory
In regex, it's usually a line. A string is a, well, string of characters.

Can you define better what it is you don't understand?
capidamonte is offline   Reply With Quote
Old 07-08-2010, 08:01 PM   #4
troymc
Groupie
troymc will become famous soon enoughtroymc will become famous soon enoughtroymc will become famous soon enoughtroymc will become famous soon enoughtroymc will become famous soon enoughtroymc will become famous soon enough
 
Posts: 161
Karma: 608
Join Date: Aug 2008
Location: Plano, TX
Device: Sony PRS-505 + B&N Nook + Motion LE1700 + Motorola Xoom Wifi
Quote:
Originally Posted by capidamonte View Post
In regex, it's usually a line. A string is a, well, string of characters.

Can you define better what it is you don't understand?
It seems pretty simple. Normally ^ refers the beginning of a line. In Sigil's find/replace dialog '^A' does not find lines beginning with 'A'. (At least not for me, does it work for you?)

So it appears that, in Sigil, ^ does *not* refer to the beginning of the line - so what does it refer to?

The docs say "beginning of string" - so what's a "string"? Is QRegExp parsing a single file as a "string"? or the whole document?


Troy
troymc is offline   Reply With Quote
Old 07-08-2010, 09:39 PM   #5
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 11,462
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
Well, I'm interested to see how this goes, as I'm struggling with a massive regex problem myself, albeit not yet in Sigil. But, the start of a string and the start of a line aren't the same thing. I think in regex if you only wanted to find the letter A at the beginning of a line you'd have to so indicate, whereas ^A would find any set of characters--string--that started with an A. I think. Maybe. cap will know.
Hitch is offline   Reply With Quote
Advert
Old 07-08-2010, 11:21 PM   #6
st_albert
Guru
st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'
 
Posts: 696
Karma: 150000
Join Date: Feb 2010
Device: none
Just a reminder that when we say "regex" there are many variants of "regular expressions" that we may be talking about. I, myself, like to think of Perl Regex, even though "that way lies madness." But at least there are definitions. If you can follow them. See, e.g. http://perldoc.perl.org/perlre.html

It all depends on what you (or your regex variant) means by "string." In PERL it usually means a "line" i.e. whatever is between two lineend characters, but that need not be the case.

Sigil uses "almost" the Perl version of regex, via QT. I'm not sure how close that is to my understanding of ""regex."

Is your brain melting yet?

Last edited by st_albert; 07-08-2010 at 11:24 PM. Reason: clarification
st_albert is offline   Reply With Quote
Old 07-09-2010, 02:17 AM   #7
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,804
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by st_albert View Post
Just a reminder that when we say "regex" there are many variants of "regular expressions" that we may be talking about. I, myself, like to think of Perl Regex, even though "that way lies madness." But at least there are definitions. If you can follow them. See, e.g. http://perldoc.perl.org/perlre.html

It all depends on what you (or your regex variant) means by "string." In PERL it usually means a "line" i.e. whatever is between two lineend characters, but that need not be the case.

Sigil uses "almost" the Perl version of regex, via QT. I'm not sure how close that is to my understanding of ""regex."

Is your brain melting yet?
And what looks like a "line" may be part of a "Wrapped paragraph" in code view.
theducks is offline   Reply With Quote
Old 07-09-2010, 04:45 AM   #8
Valloric
Created Sigil, FlightCrew
Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.
 
Valloric's Avatar
 
Posts: 1,982
Karma: 350515
Join Date: Feb 2008
Device: Kobo Clara HD
Quote:
Originally Posted by troymc View Post
So it appears that, in Sigil, ^ does *not* refer to the beginning of the line - so what does it refer to?
I think this got broken a while back. I seem to recall someone casually saying how the start of line matching isn't working correctly, but since it never ended up on the tracker, I forgot to check it out. So do add it to the tracker.

And with that I leave for vacation.
Valloric is offline   Reply With Quote
Old 07-09-2010, 05:16 AM   #9
capidamonte
Not who you think I am...
capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.
 
capidamonte's Avatar
 
Posts: 374
Karma: 30283
Join Date: Jan 2010
Location: Honolulu
Device: PocketBook 360 -- Ivory
If it's broken...

Hmmm.

Try
Code:
\nA
if you're on Windows, or
Code:
\r\nA
if you're on Linux.

Just make sure to replace the \r\n when you change stuff -- it's selected, so you don't want to overwrite it and remove a carriage return.
capidamonte is offline   Reply With Quote
Old 07-09-2010, 11:43 AM   #10
troymc
Groupie
troymc will become famous soon enoughtroymc will become famous soon enoughtroymc will become famous soon enoughtroymc will become famous soon enoughtroymc will become famous soon enoughtroymc will become famous soon enough
 
Posts: 161
Karma: 608
Join Date: Aug 2008
Location: Plano, TX
Device: Sony PRS-505 + B&N Nook + Motion LE1700 + Motorola Xoom Wifi
Quote:
Originally Posted by Valloric View Post
I think this got broken a while back. I seem to recall someone casually saying how the start of line matching isn't working correctly, but since it never ended up on the tracker, I forgot to check it out. So do add it to the tracker.

And with that I leave for vacation.
Issue 498 opened. Have a great vacation!

Quote:
Originally Posted by capidamonte View Post
If it's broken...

Hmmm.

Try
Code:
\nA
if you're on Windows, or
Code:
\r\nA
if you're on Linux.

Just make sure to replace the \r\n when you change stuff -- it's selected, so you don't want to overwrite it and remove a carriage return.
Unfortunately that didn't seem to work either.

But I know this guy Sed, and he's my friend. So I have an adequate work-around in place for what I needed to do.


Thanks, Cap!

Troy
troymc is offline   Reply With Quote
Old 07-09-2010, 04:52 PM   #11
capidamonte
Not who you think I am...
capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.
 
capidamonte's Avatar
 
Posts: 374
Karma: 30283
Join Date: Jan 2010
Location: Honolulu
Device: PocketBook 360 -- Ivory
Sounds like it's fairly-well broken then.

If you know Sed, then you're connected and we should all be asking you...
capidamonte is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding ebooks. Best engine? rvdparis General Discussions 3 08-26-2010 03:20 AM
Ebook Search Engine Drezin News 2 01-05-2010 05:16 PM
Possible scripting engine for Sigil Valloric Sigil 48 10-17-2009 09:58 AM
Paperback Digital's search engine Sparrow Workshop 7 11-26-2007 11:02 AM
Rollyo - create your own search engine doctorow Lounge 0 09-30-2005 08:40 PM


All times are GMT -4. The time now is 10:33 AM.


MobileRead.com is a privately owned, operated and funded community.