Results 1 to 3 of 3

Thread: [RESOLVED] RegExp

  1. #1

    Thread Starter
    Hyperactive Member Cyb3rH4Xter's Avatar
    Join Date
    May 2009
    Location
    Sweden
    Posts
    449

    Resolved [RESOLVED] RegExp

    I need a RegExp pattern, but i don't know how to write one?

    I want to find all sections in an inifile.

    Strings like those:

    [5636]

    [2246]

    [1264]

    thx.

  2. #2
    Hyperactive Member Zeljko's Avatar
    Join Date
    Oct 2006
    Location
    Internet
    Posts
    441

    Re: RegExp

    try this:
    VB.Net Code:
    1. 'regex with capture group: (\d*)
    2.         Dim srgx As New Regex("\[(\d*)\]")
    3. 'text you need to parse
    4.         Dim tmpstring As String = "caddf 2133 [5636] aaaa [3231] bb 3242 314365426 [331]"
    5. 'Find Capture Group in:
    6.         Dim matchG As MatchCollection = srgx.Matches(tmpstring)
    7.         MsgBox(matchG(0).Groups(1).ToString())
    8. 'in this case it will return the first found group: 5636
    1. If this post helped you, please Rate it = That's You, saying Thanks, to Me ...Left side of this post: [Rate this post]
    2. Mark this Thread Resolved if your question has been answered That's You, saying Thanks, to Group ...Menu on top of your original Post: [Thread Tools]>[Mark Thread Resolved]
    3.
    Check my site: www.er-ef.netCheck my snippets: Get installed .NET versionsRegex extractingJoin hierarchically nested Datatables in one flattened Datatable


  3. #3

    Thread Starter
    Hyperactive Member Cyb3rH4Xter's Avatar
    Join Date
    May 2009
    Location
    Sweden
    Posts
    449

    Re: RegExp

    thx man! You're the best! +rep

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width