-
1. Re: Help with writing a GREP
P Spier Aug 16, 2009 12:29 PM (in response to bookreviewer)Might help if you tell us what you've tried so far...
The slash is a special cahracter in GREP, so it needs to "escaped" or have an additional slash added in front of it. if you are looking for a pattern that has two slashes in the text (//) you'll need to escape them both (////) in your search.
-
-
3. Re: Help with writing a GREP
P Spier Aug 16, 2009 1:39 PM (in response to Plstsn)Thanks, Torben. I seem to be extremely dyslexic today with which slash is which. Forward slashes don't need to be escaped.
Which leads me to ask waht the backslash is all about in your example?
-
4. Re: Help with writing a GREP
Plstsn Aug 16, 2009 1:48 PM (in response to P Spier)Good question
Thats the escape character - they are on sale for free today
(to be honest, I didn't know that you don't have to escape the forward slashes).
Thanks Peter.
-
5. Re: Help with writing a GREP
P Spier Aug 16, 2009 1:54 PM (in response to Plstsn)Well, if you did, you'd need to escape both of each pair.
-
6. Re: Help with writing a GREP
Plstsn Aug 16, 2009 1:58 PM (in response to P Spier)You've got a point there
Torben.
-
7. Re: Help with writing a GREP
bookreviewer Aug 16, 2009 2:21 PM (in response to bookreviewer)The reason for the double slashes encasing book titles is that I had to have something unique for our book reviewers to identify book titles (which should be italicized). They enter their book reviews into a database, which doesn't allow any formatting.
Hope that sheds some light into my craziness
~Heidi
-
8. Re: Help with writing a GREP
P Spier Aug 16, 2009 2:30 PM (in response to bookreviewer)Did someone say you were crazy? I hadn't noticed.
Did you get the GREP to work?
-
9. Re: Help with writing a GREP
bookreviewer Aug 16, 2009 3:02 PM (in response to P Spier)Yes! The GREP was successful. You've saved me about an hour's worth of work each month.
THANK YOU! THANK YOU! THANK YOU! THANK YOU! THANK YOU! THANK YOU! THANK YOU! THANK YOU! THANK YOU! THANK YOU! THANK YOU! THANK YOU! THANK YOU! THANK YOU! THANK YOU! THANK YOU!
Heidi
-
10. Re: Help with writing a GREP
[Jongware] Aug 16, 2009 3:18 PM (in response to bookreviewer)(Just typed up a long answer and was logged out by the resident evil Logout Imp! Still, glad it works for you but I'd want to point out a few minor points worthy of pointing out.)
1. As the gents already mentioned, forward slashes don't need escaping. From memory, the following characters need an escape backslash in Find:
^ $ * . ? + ( ) [ ] \
The only ones I can come up with in the Replace field are
$ \
-- all other characters should be entered normally.
2. The Find expression (.*) is a greedy one: it will find everything from the very first slash in a paragraph up to the very last one (when bracketed with slashes, of course). That might work, but a safer way is the non-greedy expression
(.+?)
-- note also a '+' instead of a '*', meaning 1 or more instead of zero or more. (But double slashes with nothing inbetween them cause other problems, so I hope they just aren't there.)
3. A minor point: it's not necessary to bracket each and every part in the Find expression. Just
//(.+?)//
is enough, with
$1
(and Italics) in the Replace With field.
[Edit] Double slashes, Jongware, double slashes!
-
11. Re: Help with writing a GREP
bookreviewer Aug 16, 2009 5:41 PM (in response to [Jongware])Actually, unfortunately, the GREP is only working some of the time. Not sure why.
Here's one that it's misbehaving on. See if one of you can get it to replace book titles encased with // into italics.
------------------
//With a Twist// is one of those rare contemporary romances: realistic, modern, and romantic, yet timeless enough to never seem dated. Though this book is connected to others Martin has written, //With a Twist// definitely stands alone and also gives a previous couple an extra few hurdles to jump through in order to reach their “happily ever after”--yet it doesn’t “ruin” the happy ending of their book. This story features Natale Bocuse, a French emigre and aspiring restaurant manager, and Quinn O’Brien, New York’s top journalist. Sparks fly constantly whenever the two meet and their verbal sparring is both funny and sexy. The two are very well matched, yet their personal lives throw enough conflict on their bumpy road that Natalie and Quinn falling for one another doesn’t look too easy. There is a light thread of suspense woven through the book, but it’s so natural (since it is connected with Quinn’s job) that it’s rather unobtrusive. At its heart, //With a Twist// is a definite throwback to the sparkling romantic comedies of the 1950s, with a pair of well-written leads surrounded by a cast of quirky yet endearing characters. In a shrinking field of straight contemporary romance, //With a Twist// is a definite winner.
-
12. Re: Help with writing a GREP
Plstsn Aug 16, 2009 6:00 PM (in response to bookreviewer)The problem occurs because the //Title// is not a single Headline, which I thought it was.
You need to add a Shortest match condition to the code, so it will look like this instead:
(//)(.*?)(//)
Hope this does the trick.Torben. -
13. Re: Help with writing a GREP
bookreviewer Aug 16, 2009 6:30 PM (in response to Plstsn)That worked perfectly! Thank you very much!
Heidi
-
-
15. Re: Help with writing a GREP
Ildhund Aug 17, 2009 1:50 AM (in response to Plstsn)@ Plstsn: your last message was blank. See here:
http://forums.adobe.com/message/2165483#2165483
Noel
-
16. Re: Help with writing a GREP
P Spier Aug 17, 2009 5:15 AM (in response to Ildhund)Torben's last post wasn't really blank, it was a smiley from the web interface, and they don't show in email.
-
17. Re: Help with writing a GREP
Ildhund Aug 17, 2009 10:25 AM (in response to P Spier)(For our email readers: <blush>)
Noel




