user2924482 user2924482 - 10 months ago 80
Swift Question

Swift:Regular expression to detect IP address in string

I'trying to detect if IP address is inside of string for example:

"home is connected"

Any of you knows if is regular expression I can use to detect the ip and modify the ip?

I'll really appreciate your help

Answer Source

You can try this regex:



Then, check out this question to learn how to use this Regex in Swift to modify the current ip to a different one:

Swift replace substring regex