3

The "Comment" field records include samples like:

"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 am attempting to omit all text within parentheses from Comments records in a "CrossingName" Field.

I am using:

 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 is not returning every instance of parentheses. I copied this to try and isolate the parentheses text. I want to omit every portion of text inside parentheses. Many records have two sets of parentheses. Other questions did not address this specific scenario. Thank you for your assistance.

Currently the script throws an error and only works on one record. sample

prometheus
  • 31
  • 2
  • 2
    To get multiple matches, you must use `.Global = True` and then iterate over the match collection (right now, you only get the first match with `.Item(0)`. Besides, if you need to get the substring within the brackets, you need to access Item 0 `.Submatches(0)`. – Wiktor Stribiżew Jul 05 '17 at 20:42

0 Answers0