Regexp to validate shared URLs

0

I'm doing a Regexp that validates that the chain is a shared resource, for example \192.168.1.1\MiCarpeta\Mi subcarpeta I have taken part of the IP from the English forum

/\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/

I've done several experiments but I can not get the result I tried this

/[\.]\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b[/.][a-zA-Z\-0-9\/]/

[\.] As part of the beginning of the chain
[\.] One inverted after the IP
[a-zA-Z\-0-9\] And alphanumeric with "\" included

I am starting in regular expressions, I would like to know them thoroughly.

    
asked by Alberto Siurob 15.03.2018 в 17:28
source

1 answer

1

You could try with this regular expression:

\\(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b(\[a-zA-Z\-0-9 \/])+

graphically you can see it like this:

As you can see the inverted diagonal I put it with \ and in the last group I put it so that it could be repeated to accept the path of your folders and I included the blank spaces.

    
answered by 15.03.2018 / 17:36
source