Forum Discussion

siddhu's avatar
siddhu
Contributor
15 years ago

Need a regular expression not to select a particular word

Hi

I want a regular expression not to select a particular word



Ex: I have a string  "This is very great"

 now i dont want to select "very" from the that string.For that i want a regular expression



I am using TestComplete version 7.51 (VB Script)

2 Replies

  • Hi siddhardha,


    First of all, please note that we provide support for AutomatedQA products, not for Microsoft regular expressions syntax used in VBScript and JScript. However, here is what you can try: take the entire string and just remove the problematic word from it. You can use the native Replace method to do this. Please see the following MSDN Library article for more information:

    http://msdn.microsoft.com/en-us/library/k9z80300(VS.85).aspx


    Also, you can find more information on regular expressions here:

    http://autonomicon.blogspot.com/


  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Something else that you can do.



    My developer here made up a little .NET assembly that put some wrappers around the .NET regular expressions object that allows my to use groupings.  With that object, the following regular expression can give me back values based upon the groupings I put in the expressions...



    .*"(?<column>.*)".* row (?<row>\d*) contains .*\((?<value>.*)\) that differs from .* \((?<stored>.*)\).




    With that RegEx, I can reference the column, row, value, and stored groupings of the expression individually



    GlobalRegEx.TestCompleteUtils.GetGroupValue(GlobalRegEx.CurrentMatch, 'row').OleValue;