IP Library › Granted Patent US 11,526,553
Granted Patent B2
US 11,526,553 · App. 16/936,693 · Granted Dec 13, 2022

Building a dynamic regular expression from sampled data

Inventors: Ashutosh Gupta (San Jose, CA); Prajval Bavi (Palo Alto, CA); Gaurav Rastogi (Palo Alto, CA); Jonathan Yue (Danville, CA); Malhar Singh (Palo Alto, CA)
Assignee: VMWARE, INC.
G06F16/90344G06F16/906G06F16/9566
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,526,553
App. No.
16/936,693
Granted
Dec 13, 2022
Kind
B2
Abstract

Described are systems and methods for automatically generating, by a computing device, a regular expression that matches a list of input strings. A method includes identifying a set of baseline regular expression classes that match a portion of an input string of the list of input strings. The method further generates a current regular expression as a sequence of baseline regular expression classes from the set of baseline regular expression classes based on matching baseline regular expression classes to characters of a first input string of the list of input strings. The method further determines whether the current regular expression matches all input strings of the list of input strings, and if it does not, the method regenerates a portion of the current regular expression that occurs after an earliest character, in order, of one of the one or more input strings, that does not match the current regular expression.

Claims (68)

1. A method of automatically generating, by a computing device, a regular expression that matches a list of input strings, the method comprising:

obtaining the list of input strings;

identifying a set of baseline regular expression classes that each match at least a portion of at least one input string of the list of input strings, each baseline regular expression class of the set of baseline regular expression classes matching corresponding one or more characters,

wherein the set of baseline regular expression classes comprises a plurality of first regular expression classes and one or more generated regular expression classes,

wherein the plurality of first regular expression classes comprises one or more predefined baseline regular expression classes, and

wherein each of the one or more generated regular expression classes is a combination of two or more of the plurality of first regular expression classes and matches the corresponding one or more characters of each of the two or more of the plurality of first regular expression classes;

generating, based on a first input string of the list of input strings, a current regular expression as a sequence of baseline regular expression classes, the generating comprising, for each character of the first input string:

selecting a baseline regular expression class of the set of baseline regular expression classes that matches the character and that matches a least number of characters among any of the set of baseline regular expression classes that match the character;

determining whether the current regular expression matches all input strings of the list of input strings, the determining comprising, for each baseline regular expression class of the sequence of baseline regular expression classes:

determining whether the baseline regular expression class matches a corresponding character of each input string of the list of input strings;

for any baseline regular expression class of the sequence of baseline regular expression classes that does not match the corresponding character of an input string of the list of input strings:

updating the sequence of baseline regular expression classes of the current regular expression to include, in place of the baseline regular expression class, an updated baseline regular expression class that matches the corresponding character of the input string and the corresponding character of the first input string, wherein the updated baseline regular expression class is one of the one or more generated regular expression classes that is a combination of at least the baseline regular expression class and an additional baseline regular expression class of the set of baseline regular expression classes; and

when the current regular expression matches all input strings of the list of input strings, setting the current regular expression as the regular expression.

2. The method of claim 1 , wherein the plurality of first regular expression classes comprises one or more refined baseline regular expression classes.

3. The method of claim 1 , wherein selecting the baseline regular expression class that matches the least number of characters includes selecting the baseline regular expression class at a lowest level of a tree organizing the set of baseline regular expression classes based on their inclusion of one another.

4. The method of claim 1 , wherein the combination of at least the baseline regular expression class and the additional baseline regular expression class of the set of baseline regular expression classes is one that matches a least number of characters of all existing characters among the set of baseline regular expression classes.

5. The method of claim 1 , wherein the list of input strings comprises a list of Uniform Resource Locators (URLs), and further comprising: accepting for processing by a browser all matches to the regular expression.

6. The method of claim 1 ,

wherein the list of input strings comprises a list of filenames, and

further comprising:

searching a filesystem for all matches to the regular expression; and

returning all the matches.

7. The method of claim 1 , wherein for at least one of the one or more generated regular expression classes, the corresponding combination of two or more of the plurality of first regular expression classes is a combination of a predefined baseline regular expression class and a generated regular expression class.

8. A computing device configured to automatically generate a regular expression that matches a list of input strings, the computing device comprising:

a memory; and

a hardware processor coupled to the memory, the memory and processor being configured to:

obtain the list of input strings;

identify a set of baseline regular expression classes that each match at least a portion of at least one input string of the list of input strings, each baseline regular expression class of the set of baseline regular expression classes matching corresponding one or more characters,

wherein the set of baseline regular expression classes comprises a plurality of first regular expression classes and one or more generated regular expression classes,

wherein the plurality of first regular expression classes comprises one or more predefined baseline regular expression classes, and

wherein each of the one or more generated regular expression classes is a combination of two or more of the plurality of first regular expression classes and matches the corresponding one or more characters of each of the two or more of the plurality of first regular expression classes;

generate, based on a first input string of the list of input strings, a current regular expression as a sequence of baseline regular expression classes, the generating comprising, for each character of the first input string:

selecting a baseline regular expression class of the set of baseline regular expression classes that matches the character and that matches a least number of characters among any of the set of baseline regular expression classes that match the character;

determine whether the current regular expression matches all input strings of the list of input strings, the determining comprising, for each baseline regular expression class of the sequence of baseline regular expression classes:

determining whether the baseline regular expression class matches a corresponding character of each input string of the list of input strings;

for any baseline regular expression class of the sequence of baseline regular expression classes that does not match the corresponding character of an input string of the list of input strings:

update the sequence of baseline regular expression classes of the current regular expression to include, in place of the baseline regular expression class, an updated baseline regular expression class that matches the corresponding character of the input string and the corresponding character of the first input string, wherein the updated baseline regular expression class is one of the one or more generated regular expression classes that is a combination of at least the baseline regular expression class and an additional baseline regular expression class of the set of baseline regular expression classes; and

when the current regular expression matches all input strings of the list of input strings, set the current regular expression as the regular expression.

9. The computing device of claim 8 , wherein the plurality of first regular expression classes comprises one or more refined regular expression classes.

10. The computing device of claim 8 , wherein selecting the baseline regular expression class that matches the least number of characters includes selecting the baseline regular expression class at a lowest level of a tree organizing the set of baseline regular expression classes based on their inclusion of one another.

11. The computing device of claim 8 , wherein combination of at least the baseline regular expression class and the additional baseline regular expression class of the set of baseline regular expression classes is one that matches a least number of characters of all existing characters among the set of baseline regular expression classes.

12. The computing device of claim 8 ,

wherein the list of input strings comprises a list of Uniform Resource Locators (URLs), and

wherein the memory and processor are further configured to: accept for processing by a browser all matches to the regular expression.

13. The computing device of claim 8 ,

wherein the list of input strings comprises a list of filenames, and

wherein the memory and processor are further configured to:

search a filesystem for all matches to the regular expression; and

return all the matches.

14. The computing device of claim 8 , wherein for at least one of the one or more generated regular expression classes, the corresponding combination of two or more of the plurality of first regular expression classes is a combination of a predefined baseline regular expression class and a generated regular expression class.

15. A non-transitory computer-readable medium storing instructions that when executed by a computing device cause the computing device to perform a method of automatically generating a regular expression that matches a list of input strings, the method comprising:

obtaining the list of input strings;

identifying a set of baseline regular expression classes that each match at least a portion of at least one input string of the list of input strings, each baseline regular expression class of the set of baseline regular expression classes matching corresponding one or more characters,

wherein the set of baseline regular expression classes comprises a plurality of first regular expression classes and one or more generated regular expression classes,

wherein the plurality of first regular expression classes comprises one or more predefined baseline regular expression classes, and

wherein each of the one or more generated regular expression classes is a combination of two or more of the plurality of first regular expression classes and matches the corresponding one or more characters of each of the two or more of the plurality of first regular expression classes;

generating, based on a first input string of the list of input strings, a current regular expression as a sequence of baseline regular expression classes, the generating comprising, for each character of the first input string:

selecting a baseline regular expression class of the set of baseline regular expression classes that matches the character and that matches a least number of characters among any of the set of baseline regular expression classes that match the character;

determining whether the current regular expression matches all input strings of the list of input strings, the determining comprising, for each baseline regular expression class of the sequence of baseline regular expression classes:

determining whether the baseline regular expression class matches a corresponding character of each input string of the list of input strings;

for any baseline regular expression class of the sequence of baseline regular expression classes that does not match the corresponding character of an input string of the list of input strings:

updating the sequence of baseline regular expression classes of the current regular expression to include, in place of the baseline regular expression class, an updated baseline regular expression class that matches the corresponding character of the input string and the corresponding character of the first input string, wherein the updated baseline regular expression class is one of the one or more generated regular expression classes that is a combination of at least the baseline regular expression class and an additional baseline regular expression class of the set of baseline regular expression classes; and

when the current regular expression matches all input strings of the list of input strings, setting the current regular expression as the regular expression.

16. The non-transitory computer-readable medium of claim 15 , wherein the plurality of first regular expression classes comprises one or more refined regular expression classes.

17. The non-transitory computer-readable medium of claim 15 , wherein selecting the baseline regular expression class that matches the least number of characters includes selecting the baseline regular expression class at a lowest level of a tree organizing the set of baseline regular expression classes based on their inclusion of one another.

18. The non-transitory computer-readable medium of claim 15 , wherein the combination of at least the baseline regular expression class and the additional baseline regular expression class of the set of baseline regular expression classes is one that matches a least number of characters of all existing characters among the set of baseline regular expression classes.

19. The non-transitory computer-readable medium of claim 15 , wherein the list of input strings comprises a list of Uniform Resource Locators (URLs), and the method further comprising accepting for processing by a browser all matches to the regular expression.

20. The non-transitory computer-readable medium of claim 15 , wherein for at least one of the one or more generated regular expression classes, the corresponding combination of two or more of the plurality of first regular expression classes is a combination of a predefined baseline regular expression class and a generated regular expression class.

Assignments (2)
CHANGE OF NAME Recorded Apr 15, 2024
From: VMWARE, INC.
To: VMWARE LLC
Reel/Frame 067102/0395 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Sep 9, 2020
From: GUPTA, ASHUTOSH; BAVI, PRAJVAL; RASTOGI, GAURAV; YUE, JONATHAN; SINGH, MALHAR
To: VMWARE, INC.
Reel/Frame 053721/0503 →
Continuity (1)
Related Publication 20220027418A1 · Jan 27, 2022