Dynamic Text and Text Formatting Tag Parser/Method/Regex

425
3
10-05-2011 05:36 AM
MeToo
by
New Contributor
Hi:

I need to parse both dynamic text and text formatting tags to get to the actual displayed text string. I couldn't find an ArcObjects method that does that.

Has anybody developed such parser and if so how can I access it? I would expect that it would be based on Regular Expresssions (regex). I am using .NET.

Thanks,
Dennis
0 Kudos
3 Replies
JamesCrandall
MVP Frequent Contributor
Hi:

I need to parse both dynamic text and text formatting tags to get to the actual displayed text string. I couldn't find an ArcObjects method that does that.

Has anybody developed such parser and if so how can I access it? I would expect that it would be based on Regular Expresssions (regex). I am using .NET.

Thanks,
Dennis


Without knowing exactly what it is you are attempting to accomplish, here's a very simple example of how to use Regex.  The result would be the MsgBox popup as "blah2".

(also: you will need Imports System.Text.RegularExpressions)
           
            Dim theString As String = "blah1 blah2 blah3"
            Dim rx As New Regex("blah2(.*?)")
            Dim matches As MatchCollection = rx.Matches(theString)

            For Each match As Match In matches
                Dim groups As GroupCollection = match.Groups
                MsgBox("Found :" & groups.Item(0).Value() & groups.Item(1).Value)
            Next


Hope this helps!
0 Kudos
MeToo
by
New Contributor
Thanks,
Dennis
0 Kudos