OpenXmlRegex Is it possible to do a replacement being a regex pattern?

Home Forums Open-Xml-PowerTools OpenXmlRegex Is it possible to do a replacement being a regex pattern?

This topic contains 2 replies, has 2 voices, and was last updated by  porkopek 8 years, 2 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #3597

    porkopek
    Participant

    Hi, Eric:

    Thanks for your work.

    Is it possible to do a replacement in OpenXmlRegex.Replace with the replacement string being a pattern too?
    Let’s put an example:

    content="$95"
    pattern ="($)([0-9]+)"
    replacement="$2 $1"

    I am expecting
    result="95 $"
    but I’m getting
    result="$2$1"

    How can I get my desired result?
    Is there any place in the source code I can make a replacement within a pattern?

    Thank you very much

    #3667

    Eric White
    Keymaster

    Hi,

    Sorry for the slow response – have been on vacation, and dealing with illness of a family member.

    Currently, the scenario you describe is not a feature of OpenXmlRegex. It is a great idea, though. I have added it to the list of possible enhancements to OpenXmlRegex.

    Best, Eric

    #3669

    porkopek
    Participant

    Hi, again, Eric.

    So sorry for the illnes of your family member.

    Is it currently possible to make find and replace statements using wildcards like in MS Word?
    Is not a real regex, but something is better than nothing.

    Could you give me some guidelines to implement myself regex replace? Maybe some place in the code that would be a start point…

    Thank you very much for all of your work in the PowerTools project.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.