• Wild Card Bold Between 2 Characters in a string

    Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » Wild Card Bold Between 2 Characters in a string

    • This topic has 8 replies, 3 voices, and was last updated 9 years ago.
    Author
    Topic
    #505487

    Hello folks,:)

    I have a document that has html in it.

    I am trying to bold between 2 characters in the HTML

    Bold anything between first character angle and

    In between there may be letters and Numbers and ” quotation marks and an equal sign

    This is what I have so far after failure of other methods – this doe not work

    <[[d]A-z0-9"=]+>

    it should bold

    Hello

    Hello

    I have tried a lot of combinations and cant seem to fix this 🙁

    I appreciate the assistance from the resident pros on regex wildcards

    thanks

    pb

    Viewing 6 reply threads
    Author
    Replies
    • #1562117

      PB,

      This RegEx string: [noparse]()[/noparse]

      Should do the trick.

      Document Before:
      44364-RegExBefore

      Setup of S&R:
      44365-RegExResults

      Document After:
      44366-RegExAfter

      HTH :cheers:

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

    • #1562127

      RG,

      nice to see you again.:D

      I dont know how you did it but its sings beautifully, if there was an idiom to explain my elation.

      ()

      Wow I am really impressed, i have spent hours on online regex testers, had to give up in the end.:(

      Smashing

      thanks ever so much

      have a fantastic day!!:cheers:

      pb

      oh and as always thanks for the screen shots – i really did have to look at it 3 times

    • #1562130

      PB,

      Here’s an explaination of the RegEx:

        [*]() are used to group items, used in the replace command. Note there are 3 groupings thus the 123 in the example.
        [*] is the Escape character, e.g. treat the following character as a normal character not a RegEx special meaning.
        [*] end of word this is why they are Escaped in the sample in the previous post since we want to fine the HTML Tags.
        [*][ ] Any of the included characeters/character Ranges, indicated by -, e.g.: A-Z
        [*]{n,n} Find at least (1st n) this many of the items in the previous group, (2nd n) find no more than this many occurrences of previous group. Thus in our example it must find at least 2 “<d" and we don't care how many thus no limit specified.
        [*]

      OOPS! I just realized I forgot the 0-9 range in the second grouping!

      HTH :cheers:

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

    • #1562151

      You could use just:
      Find = ]@>

      I can’t see the point of the grouping or the need for all the other character testing in the expression.

      Cheers,
      Paul Edstein
      [Fmr MS MVP - Word]

      • #1562155

        You could use just:
        Find = ]@>

        Paul,

        This intrigued me so I gave it a try but got this:
        44369-PaulRegex

        Am I missing something? :cheers:

        May the Forces of good computing be with you!

        RG

        PowerShell & VBA Rule!
        Computer Specs

    • #1562154

      Paul & RG,

      thank you ever so much.

      I try to avoid regex and wild cards – I start off full of hope and soon enough Ive got it all back wards,
      but as we know they are an occupational hazard to the uninitiated;)

      I am very obliged

      Good Evening to all

      pb

    • #1562156

      Did you check the ‘use wildcards’ option?

      Cheers,
      Paul Edstein
      [Fmr MS MVP - Word]

    • #1562160

      Paul,

      44372-HomerDOH

      Works Like a Charm! :cheers:

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

    Viewing 6 reply threads
    Reply To: Wild Card Bold Between 2 Characters in a string

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: