Gravatar for vajani@coveo.com

Question by victor, Feb 26, 2015 11:48 AM

Using a regex to query for indexed IPV4 addresses

If there are IPV4 addresses indexed(appearing on indexed documents) in a format like this: 24.183.1.188 etc

Is there a type of regex logic that could be used to find all IP's throughout the index? All IP's within a certain type of range i.e "24.n.n.n" ? Could a post-conversion script detect the addresses though a regex logic? Individual IP addresses can be found but it would be nice to use a regex to find them in a batch

1 Reply
Gravatar for jfcadrin@coveo.com

Answer by JFCG, Feb 26, 2015 3:16 PM

I'm no regex expert and consequently did not test against it, but the following looks promising for the regular expression part.
…………………….
https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html
…………………….

So I think you could most certainly write a post-conversion script that would detect ipv4 addresses and feed either 1) the entire address into a single field, 2) the network and host parts into two distinct fields, or even 3) each of the four one-byte parts into four separate fields.
…………………….
http://docs.oracle.com/cd/E19455-01/806-0916/6ja85399u/index.html
…………………….

Some samples one might use to build on:
…………………….
https://developers.coveo.com/display/Converter/Postconversion+Script+Samples
…………………….

Ask a question