1
"value:=This customer has one or more active tax exemptions available\.
\n
 \n
Do you want to apply a tax exemption to this transaction\?"

I tried regular expression like "Value:=This.*" but it is not identifying entire text. Please tell me how can i identify entire text using VbScript regular expression by validating only first word in the entire text. Thanks.

Hackoo
  • 15,943
  • 3
  • 28
  • 59
Krish V
  • 31
  • 4

2 Answers2

0

See: How do I match any character across multiple lines in a regular expression?

For example:

Dim s : s = "value:=This customer has one or more active tax exemptions available." & vbCrLf & vbCrLf & "Do you want to apply a tax exemption to this transaction?"
With New RegExp
    .Pattern = "^value:=This(.|\n|\r)*"
    With .Execute(s)
        WScript.Echo .Item(0).Value
    End With
End With

...whose .Pattern starts with (^) 'value:=This', followed by any character (.), line feed (aka, newline) (\n), or carriage return (\r) repeated zero or more times (*).

Output:

value:=This customer has one or more active tax exemptions available.

Do you want to apply a tax exemption to this transaction?

Hope this helps.

leeharvey1
  • 737
  • 3
  • 11
0

I guess,

value:=This\b[\s\S]*

might work OK.

Demo


If you wish to simplify/modify/explore the expression, it's been explained on the top right panel of regex101.com. If you'd like, you can also watch in this link, how it would match against some sample inputs.


Community
  • 1
  • 1
Emma
  • 1
  • 9
  • 28
  • 53