There is a large text in which IP I want to extract the IP from by entering the text in the textbox and when I press the button it extracts and shows me the IP using c#
Asked
Active
Viewed 52 times
0
-
Welcome to Stack Overflow. Please at least provide what kind of environment you are working in and a sample of that 'large text'. – Dandry Jan 28 '22 at 07:11
-
any idea how you want to solve this? any code you want to share? – ΦXocę 웃 Пepeúpa ツ Jan 28 '22 at 07:12
-
IPv4? IPv6? Both? – ProgrammingLlama Jan 28 '22 at 07:12
-
I've linked some duplicates, that typically use a file as the source string but I trust you know how to get the text out a TextBox.Text, which is conceptually the same as having read a file into a string. Take a look at some answers that use regular expressions to scan a string for an IP and output it. They normally take the form of looking for four sets of numbers separated by a dot. If you're looking for ipv6 it'll be upto six sets of hex numbers separated by colons; I don't doubt a Google for "ipv6 Regex" will bring plenty of suggestions for how to alter your pattern to search for that – Caius Jard Jan 28 '22 at 07:32
-
Or maybe you meant that the file path will be entered into the text box, which should mean the linked duplicates are nearly a drop-in code for what you wabt – Caius Jard Jan 28 '22 at 07:34