Word wildcards/regex search from the begining of line till the first :

6,474
  1. Word doesn't allow you to change case with a Find & Replace that I know of. The best you can do there is change the case of each selection as you find them. (So, instead of hitting Replace All and being done with it, you'd use Find Next, then use the Case button on the Font area of the Home tab to select Sentence Case.)

  2. To get the text before the colon bold, you'd use the following:

    Find what: (^13*:)

    Replace with: \1

    With the cursor in the Replace with field, use Ctrl+B to make the replacement bold.

^13 is the code for a paragraph mark, * is the "any character or group of characters, of any number" wildcard, and the \1 repeats whatever is in the parentheses.

The paragraph mark is needed because just using (*:) will find "Duis pulvinar, enim montes :" then "uis pulvinar, enim montes :" then "is pulvinar, enim montes :" and so on, one character at a time. So, the paragraph mark gives it a place to begin. The downside of that is that it won't find the first instance unless there's another paragraph before it. (Using your sample text, it replaced the last three lines, but not the first.)

Share:
6,474

Related videos on Youtube

Enissay
Author by

Enissay

Updated on September 18, 2022

Comments

  • Enissay
    Enissay over 1 year

    In MS word 2013 I'm having multiple lines like:

    Duis pulvinar, enim montes : magna tincidunt penatibus nec amet a nec tristique rhoncus aliquet?

    porttitor diam amet : nascetur sociis dapibus nascetur augue in, risus, sagittis etiam ultricies

    dapibus scelerisque : urna tortor aliquam, platea

    vel placerat! : Nisi rhoncus in est aliquet adipiscing. Diam nascetur amet parturient

    ...

    I want to do the following:

    1. Make the first letter of each line uppercase
    2. Make all the text up to the first : Bold. <== I'm exaclty stuck on how to select this specific text !!

    I'm more cumfortable using regexes rather than wildcards, so I can easily do point 1 (with sublimeText or notepad++): /^(.)/\u\1/

    Point 2 could also be done If I knew what special characters MS uses to mark text as Bold (like the ** in Markdown) before importing it back to word /^([^:]+)/???/... Well, if it is that simple xD

    If not, please advice me on the simplest way to achieve this since I have hundreds of lines like this.

    PS: I just saw that open office allows regexes use, so i'm probably gonna go with that, but I'm still wondering how to do so in MS word when I've no access to OO

    Solution:

    Short:

    enter image description here

    Long: Check Kelly's answer bellow

  • Enissay
    Enissay over 9 years
    Oh, I've read that but I wasnt using it correctly... Thanks to you, I know now why :)