I have a regex, but i am not able to use in isMatch activity, Am i doing anything wrong:
Color is the word i am searching for
Var MyWord=“Color”
(?<=Title=“[^”])\b+MyWord+\b(?=[^"]")
Hi @hansen_Lobo ,
Could you let us know if you have verified it in one of the Regex Testing sites ?
If not, Could you provide us with the Sample data and the data that you want to match. We could check it out in the below regex testing portal :
Then correct it as needed.
The sample data. i used https://regexr.com/
<TocEntry
Title="Color" - Highlight this text Color
Title=["Color"] - Ignore this text Color
Link="/Content/Color/" - ignore this text Color
BreakType="Color" - ignore this text Color
StartSection="false"
PageNumberReset="Color"> - ignore this text Color
</TocEntry>
<TocEntry
Title="Colord"> - ignore this text Colord
//there could be Link="abc", BreakType="abc" here aswell
</TocEntry>
<TocEntry
Title="dColord"> - ignore this text dColord
</TocEntry>
<TocEntry
Title="my fav Color is red"> - Highlight this text Color
Title=["my fav Color is red"]> - - ignore this text Color
</TocEntry>
<TocEntry
Title="my fav
Color
is red"> - Highlight this text Color
</TocEntry>
Unable to match with all the conditions
Could you let us know what do you mean by this ? Do you have varying data ?
If so, we need to understand how does the data vary from the data provided above.
Here are 3 conditions:
-
I need to replace text only if its inside Title=“The serach term here can be selected”.
-
I dont want to replace text within square brackets inside Title=[“The text here no replacing”]
-
The word should exactly match the term.
Could you verify back whether the given data is correct ? Is the Square Bracket before the Double Quotes, if so then the Provided Regex should work fine and replace only words starting from double quotes.
Title=“Color” - Highlight this text Color
Title=[“Color”] - Ignore this text Color
Title=“A red Color bus”- Highlight this text Color
Title=“A red Colored bus” -Ignore this text Color
Variable="A red Color bus "-Ignore this text Color since not Title=
Not so sure if we are fully understanding the requirement. Do check the below match :
The word Color in line 3 doesn’t Highlight
Could you check with the modified Regex Expression below :
(?<=Title="".*)\bColor\b(?=.*"")
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.