Got more questions? Find advice on: ASP | SQL | XML | Windows
in Search
Welcome to RegexAdvice Sign in | Join | Help

Regex for a string that only specifies parts at the beginning and the end.

Last post 11-23-2009, 2:30 PM by supersonictony. 2 replies.
Sort Posts: Previous Next
  •  11-20-2009, 2:45 PM 57426

    Regex for a string that only specifies parts at the beginning and the end.

    I'm generating documentation in an XML editor. Search and replace is available in the tool I use - along with a setting for Regex!
     
    What I'm trying to do is avoid scripting and handle more powerful search and replace strings. Often, I'm able to specify only portions of a string, for example, say I wanted to find all occurrences of <img src=" in the following markup.
     
    <img src="Images/trigger-edge-bttn-blk.png" MadCap:conditions="Soda.Pepsi,Soda.Dr.Pepper,Soda.Coke" /> 
     
    But, I wanted to also find conditions for Dr.Pepper, so...  MadCap:conditions=" and Soda.Dr.Pepper would also need to be found. Where I'm confused is how do indicate that there's space between these elements of which I won't know the specific length? Meaning, I won't know how long the image name is (since there are thousands of them) and I won't know how many other conditions may have preceded Dr.Pepper. This way I could either change an existing condition (say, replace Dr. Pepper to Mr. Pibb), or tack on a new condition by putting Soda.Dr.Pepper,Soda.Mr.Pibb in its place.
     
    Many thanks in advance.

    Tony
  •  11-21-2009, 2:37 PM 57435 in reply to 57426

    Re: Regex for a string that only specifies parts at the beginning and the end.

    supersonictony:
    I'm generating documentation in an XML editor. Search and replace is available in the tool I use - along with a setting for Regex!

    Which XML editor?


    Michael

    "In theory, theory and practice are the same. In practice, they are not."
    Albert Einstein
  •  11-23-2009, 2:30 PM 57466 in reply to 57435

    Re: Regex for a string that only specifies parts at the beginning and the end.

    It's actually the XML editor provided in MadCap Flare's HAT.
    Tony
View as RSS news feed in XML