Results 1 to 3 of 3

Thread: Extract from textbox

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2011
    Posts
    58

    Extract from textbox

    I have a textbox with data.
    Code:
    "data": "100005337941637",
    "data": "100004464150724",
    etc...
    I want just numbers("100005337941637").

    How can I extract to an another textbox?


    Thank you.
    Last edited by sandor555; Nov 27th, 2014 at 06:00 PM.

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    23,407

    Re: Extract from textbox

    try regex:

    Code:
    Imports System.Text.RegularExpressions
    
    Public Class Form1
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            For Each m As Match In New Regex("\d+").Matches(TextBox1.Text)
                TextBox2.Text &= m.Value & Environment.NewLine
            Next
        End Sub
    
    End Class

  3. #3

    Thread Starter
    Member
    Join Date
    Aug 2011
    Posts
    58

    Re: Extract from textbox

    Thank you!

    I forgot to write...My textbox constains multiple numbers.

    Examle:
    "data": "10152297032458306_9682884",
    "from": {
    "data": "100004464150724",

    But, I just want one line("data": "100004464150724",).

    My textbox output after I use your regex code:
    Code:
    10152297032458306
    9682839
    100004464150724
    0040
    0
    0
    6
    0
    6
    3
    0
    24
    23
    2013
    03
    14
    etc....

    But it's good start for me. I try to find a solution.


    Edit:

    We can filter my numbers?
    example: If my text have 6-8 number then it's okay, if not then it will be delete.
    Last edited by sandor555; Nov 27th, 2014 at 06:15 PM.

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