RegEx... need help

Discussion in 'Questions (Windows Mobile)' started by linum, Jan 15, 2009.

  1. linum

    linum Active Member Licensed User

    I have an arraylist with different kinds of data but I added key words that I would like RegEx to replace.

    For example, the arraylist could contain data as:


    "Mr. nnaammee is scheduled for physical therapy on ddaattee."



    What is the correct syntax for looping through the arraylist, finding each instance of nnaammee and ddaattee and replacing it with a text value located on a text box?


    As always... thank you for your fine help.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Something like:
    Code:
    For i = 0 to ArrayList1.Count-1
     str = ArrayList1.Item(
    0'Always the first item
     Regex1.Replace(str,textbox1.text)
     ArrayList1.RemoveAt(
    0)
     ArrayList1.Add(str)
    Next
     
  3. linum

    linum Active Member Licensed User

    Thank you for your reply. Your example helped me figure out what I needed. Here is the correct syntax I was looking for:

    Code:
    regex1.New1("nnaammee")
       
       
    For i = 0 To ArrayRefLoad.Count-1
           s = ArrayRefLoad.Item(i)
           s = regex1.Replace(s, txtName.text)
          ArrayRefLoad.Item(i) = s
       
    Next
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice