How to remove multiple text in parentheses using regular expression in ArcGIS VB field calculator?

Comment field entries include the following examples:

"Line marker, Fence, Test station (Single: Struct P/S -1.2375V IRF -1.0976V) (ACV: 0.0412V)"



"Direction: DownStreamDate Collected: 5/8/2013:START POS RUN ON , Line marker, Test station, Fence, , Aerial marker , 222 MP 221.89 CALI 0.2 0.3 SUNNY END WARM"

      

I'm trying to loop through all of the parenthesized text from the comment entries in the "CrossingName" field.

I use:

 Pre-Logic Script Code:
    Set re = CreateObject("VBScript.RegExp")
    With re
        .Pattern = "\([^()]*\)"
        .Global = False
        .IgnoreCase = False
    End With

CrossingName = re.Execute(targetString).Item(0)

      

The regular expression does not return every instance of parentheses. I copied this to try and isolate the parentheses text. I want to omit every piece of text in parentheses. Many entries have two sets of parentheses. Other questions were not related to this particular scenario. Thank you for your help.

The script currently throws an error and only works on one entry. sample

+3


source to share





All Articles