java - Converting regex query to English keyword query -


i trying convert regex query keyword query, such keyword query gives me superset of regex query. example

  • "host." can convert "host"
  • "host ((?10\.6\.2*)) chuckn*" can convert "host *", "10 6 ", "chuck"
  • "host.* registered.+" can convert "host*", "registered*"
  • "10\.64\.2*" can convert "10 64 *"

for looking regex tree leaf elements can combined keyword query. trying access data structure inside pattern class in java used store regex. please let me know how done or if there other way.

    system.out.println(       (     "host."         + "\nhost ((?10\\.6\\.2*)) chuckn*"         + "\nhost.* registered.+"          + "\n10\\.64\\.2*"       )         .replaceall("(.?\\*)", "*")         .replaceall("\\.\\+", "*")         .replaceall("\\\\.", " ")         .replaceall("(\\.?[^a-za-z0-9 \\*\\n])", "")     ); 

output

host host 10 6 * chuck* host* registered* 10 64 * 

edit : last replaceall line corrected.

may have complete sstring in last .replaceall("sstring", "").


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -