c# - a simple Regex question -
I'm trying to learn about im regex, and how it uses braking some logs and the results With some text boxes populated
If I have such a simple line
Port status: tro-S-02-av1 0/23
and tro-S- 02
All names on Eva 1 end, thus regular axis should be based on this.
I was thinking that I wanted to become a string-s-02-av1 string text box, but I can not get it properly, how can I do this?
Regex r; Match Me; R = new regenges ("$` \ av1 "); Me = R. Match ("Port Status: ST-S-02-AV1 0/23"); Nodetbx.Text = m.Value; Using groups with the following regex (for example, you can probably clear it)
will give you two named groups, Id 1 and ID2, then you can populate.
I found using nominated groups when learning for the first time is regex, then you can actually see what is happening.
regex r = new regex ("Port Status: (? Id> [\ d \ w \ -] +) \ s (& lt ;; Id2> [\ s \ s] +) "); Matchcolene MC = RMacente (Mytext); Foreach (Match M in MC) {string ID1 = m.groups ("ID1"); String ID2 = m.groups ("ID2"); }
Where the metaest is either looping through each line through a readline or full file, if not too large.
Then you can rename ID1 and ID2 (to change its name to populate the text box or whatever).
Comments
Post a Comment