Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 01-09-2012, 09:58 AM   #1
bfollowell
Fanatic
bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.
 
Posts: 541
Karma: 1152752
Join Date: Aug 2010
Location: Evansville, IN, USA
Device: Samsung Galaxy Tab 4 Nook & Samsung Galaxy Tab S 10.5
Help with regex expression for words in all caps

I am attempting to create a regex expression that will allow me to search for "words" made up of consecutive upper case characters such as DANGER or WARNING. I tried [A-Z]+ and it does not work.

[A-Z] returns any and every occurence of an upper case character, single or multiple, one at a time.
[A-Z]+ returns groups of upper case characters as well as single upper case letters

I can't seem to find an expression that will return only groups of consecutive upper case characters. I don't care about the singles at the beginning of a sentence or a proper name.

I know Sigil regex has some quirks that work differently than in other apps that use regex. Does anyone have any ideas?

- Byron
bfollowell is offline   Reply With Quote
Old 01-09-2012, 10:18 AM   #2
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,807
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Code:
([A-Z]){3,}
the first number is a minimum repetition count
the Second is a maximum. infinite if nil after the comma
theducks is offline   Reply With Quote
Advert
Old 01-09-2012, 10:18 AM   #3
andyh2000
Avid reader
andyh2000 ought to be getting tired of karma fortunes by now.andyh2000 ought to be getting tired of karma fortunes by now.andyh2000 ought to be getting tired of karma fortunes by now.andyh2000 ought to be getting tired of karma fortunes by now.andyh2000 ought to be getting tired of karma fortunes by now.andyh2000 ought to be getting tired of karma fortunes by now.andyh2000 ought to be getting tired of karma fortunes by now.andyh2000 ought to be getting tired of karma fortunes by now.andyh2000 ought to be getting tired of karma fortunes by now.andyh2000 ought to be getting tired of karma fortunes by now.andyh2000 ought to be getting tired of karma fortunes by now.
 
andyh2000's Avatar
 
Posts: 826
Karma: 6377682
Join Date: Apr 2009
Location: UK
Device: Samsung Galaxy Z Flip 4 / Kindle Paperwhite
Just a guess, but have you tried:

Code:
[A-Z][A-Z]+
instead?

Andrew
andyh2000 is offline   Reply With Quote
Old 01-09-2012, 10:31 AM   #4
bfollowell
Fanatic
bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.
 
Posts: 541
Karma: 1152752
Join Date: Aug 2010
Location: Evansville, IN, USA
Device: Samsung Galaxy Tab 4 Nook & Samsung Galaxy Tab S 10.5
Both of these seem to work as I wanted. The second one works best for any number of multiple characters. The first one works better if I only want to look for words x number of characters or longer. I'll make certain to save both of these in my really, really, big book of commonly used regex expressions. Thanks guys.

- Byron
bfollowell is offline   Reply With Quote
Old 01-09-2012, 10:38 AM   #5
Serpentine
Evangelist
Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.
 
Posts: 416
Karma: 1045911
Join Date: Sep 2011
Location: Cape Town, South Africa
Device: Kindle 3
If you're using one of the beta versions, and you want to get upper case words, a better option would be something like : \b[[:upper:]]{2,}\b
Serpentine is offline   Reply With Quote
Advert
Old 01-09-2012, 11:44 AM   #6
WS64
WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.
 
WS64's Avatar
 
Posts: 660
Karma: 506380
Join Date: Aug 2010
Location: Germany
Device: Kobo Aura / PB Lux 2 / Bookeen Frontlight / Kobo Mini / Nook Color
Quote:
Originally Posted by theducks View Post
Code:
([A-Z]){3,}
the first number is a minimum repetition count
the Second is a maximum. infinite if nil after the comma
I'd be very careful with that one, especially if you want to use the replace function.
Much better:
([A-Z]{3,})

Else you will just replace ONE letter with \1...

The suggestion from Serpentine will "only" find complete words that are uppercase, that might be what you want or not, I can't decide...
WS64 is offline   Reply With Quote
Old 01-09-2012, 12:04 PM   #7
bfollowell
Fanatic
bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.
 
Posts: 541
Karma: 1152752
Join Date: Aug 2010
Location: Evansville, IN, USA
Device: Samsung Galaxy Tab 4 Nook & Samsung Galaxy Tab S 10.5
Quote:
Originally Posted by Serpentine View Post
If you're using one of the beta versions, and you want to get upper case words, a better option would be something like : \b[[:upper:]]{2,}\b
I know, in the past, the posix classes never seemed to work. Is that one of the new additions from the beta versions? I was using beta 0.4.0 and I'm pretty sure they didn't work then. I'll be glad to see them though.

Thanks again to everyone for all of the help.

- Byron
bfollowell is offline   Reply With Quote
Old 01-09-2012, 12:11 PM   #8
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,807
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 WS64 View Post
I'd be very careful with that one, especially if you want to use the replace function.
Much better:
([A-Z]{3,})

Else you will just replace ONE letter with \1...

The suggestion from Serpentine will "only" find complete words that are uppercase, that might be what you want or not, I can't decide...

That is why it happened
theducks is offline   Reply With Quote
Old 01-09-2012, 09:03 PM   #9
Serpentine
Evangelist
Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.
 
Posts: 416
Karma: 1045911
Join Date: Sep 2011
Location: Cape Town, South Africa
Device: Kindle 3
Quote:
Originally Posted by bfollowell View Post
I know, in the past, the posix classes never seemed to work. Is that one of the new additions from the beta versions?
Yup, you have pretty much all of the PCRE library to play with now.

http://www.pcre.org/pcre.txt

Covers pretty much everything, not exactly nice reading, but if you jump around a bit you'll find lists of all of the nifty stuff, some nice examples.
Serpentine is offline   Reply With Quote
Old 01-20-2012, 05:11 PM   #10
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,994
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
in 4.2, how would I replace uppercase between a span to lowercase?

For example,
Code:
<span class="small">THIS IS UPPERCASE</SPAN>
There could be multiple instances on the same line. This is so I can easily fix the fake smallcaps to true smallcaps easily.
JSWolf is online now   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with a Regex Expression? adept22 Library Management 2 03-16-2011 06:50 AM
regex to fix up hyphenated words please cybmole Sigil 2 01-06-2011 04:13 AM
help with regex expression daesdaemar Workshop 4 02-19-2010 07:38 AM
Unutterably Silly ANGRY CAPS Not_A_Crook Lounge 56 12-10-2009 01:16 AM
Need help with regex expression daesdaemar Workshop 18 02-07-2009 03:48 PM


All times are GMT -4. The time now is 06:35 PM.


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