RegEx... need help

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.
 

Erel

Administrator
Staff member
Licensed User
Something like:
B4X:
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
 

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:

B4X:
       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
 
Top