|
|
#1 |
|
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 |
|
|
|
|
|
#2 |
|
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,271
Karma: 61916422
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 Second is a maximum. infinite if nil after the comma |
|
|
|
| Advert | |
|
|
|
|
#3 |
|
Avid reader
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 897
Karma: 6543210
Join Date: Apr 2009
Location: UK
Device: Samsung Galaxy Z Flip 6 / Kindle Paperwhite / TCL Nxtpaper 14
|
Just a guess, but have you tried:
Code:
[A-Z][A-Z]+ Andrew |
|
|
|
|
|
#4 |
|
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 |
|
|
|
|
|
#5 |
|
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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
|
|
|
|
| Advert | |
|
|
|
|
#6 | |
|
♫
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 661
Karma: 506380
Join Date: Aug 2010
Location: Germany
Device: Kobo Aura / PB Lux 2 / Bookeen Frontlight / Kobo Mini / Nook Color
|
Quote:
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... |
|
|
|
|
|
|
#7 | |
|
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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:
Thanks again to everyone for all of the help. - Byron |
|
|
|
|
|
|
#8 | |
|
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,271
Karma: 61916422
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
![]() That is why it happened
|
|
|
|
|
|
|
#9 | |
|
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 416
Karma: 1045911
Join Date: Sep 2011
Location: Cape Town, South Africa
Device: Kindle 3
|
Quote:
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. |
|
|
|
|
|
|
#10 |
|
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 80,825
Karma: 150249619
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> |
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help with a Regex Expression? | adept22 | Library Management | 2 | 03-16-2011 07:50 AM |
| regex to fix up hyphenated words please | cybmole | Sigil | 2 | 01-06-2011 05:13 AM |
| help with regex expression | daesdaemar | Workshop | 4 | 02-19-2010 08:38 AM |
| Unutterably Silly ANGRY CAPS | Not_A_Crook | Lounge | 56 | 12-10-2009 02:16 AM |
| Need help with regex expression | daesdaemar | Workshop | 18 | 02-07-2009 04:48 PM |