-2

I need help with a GREP expression to find and replace a variable group of words. The sentence always starts with the same two words (Bold italicized) and always ends with a (colon), but the bit in the middle varies. So I need to search for:

Bold italicized then any string of words then :

ie. starts with "Bold italicized", then any group of words, ends with ":"

For example:

Bold italicized May 6, 2010:

I will then apply some formatting to that text. Thank you.

Cyrus
  • 84,225
  • 14
  • 89
  • 153
RexTheRunt
  • 141
  • 1
  • 3
  • 12

2 Answers2

2

The right tool do do this is not but :

EXAMPLE in a shell :

$ cat file.txt 
Bold italicized foo bar:
Bold italicized qux:
$ sed 's/^Bold italicized\(.*\):/do something with "\1"/g' file.txt
do something with " foo bar"
do something with " qux"
$ 

NOTE

  • you will find tons of examples and documentation here or here
  • the basic sed substitution command is s/regex/substitution/modifier
  • that use regex, I use ^ that means beginning of line, and \( \) to make a capture
Gilles Quénot
  • 173,512
  • 41
  • 224
  • 223
  • I should have been more clear. I'm not using this from the command line. I'm using the GREP search and replace tool within Adobe Indesign. – RexTheRunt Nov 14 '12 at 04:18
0

This should do it, although this is a pretty simple one, so it seems like you should have been able to come up with this yourself, even as a beginner.

^Bold italicized.+?:

If you want to learn a little bit more about how to use GREP, I would recommend the InDesign GREP reference.

Josh Voigts
  • 4,114
  • 1
  • 18
  • 43
  • Thanks a lot. In the end I used (bold italicized )( *.*\w*\d*)(:) and replaced with $2$3 which worked perfectly. – RexTheRunt Nov 14 '12 at 16:33