Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regexp can not match #11

Open
david-sail opened this issue Jan 4, 2018 · 4 comments
Open

regexp can not match #11

david-sail opened this issue Jan 4, 2018 · 4 comments

Comments

@david-sail
Copy link

regexp: (.)的(?:联系方式|电话|电话号码|手机号)
string: david的联系方式
result: can not match
code:
List strRegList = new ArrayList(5);
strRegList.add("(.
)的(?:联系方式|电话|电话号码|手机号)");

	int [] subList = MultiPattern.of(strRegList).matcher().match("david的联系方式");
@fulmicoton
Copy link
Owner

dkbrics does not handle capturing groups.

can you try
(.)的(联系方式|电话|电话号码|手机号)

@david-sail
Copy link
Author

get it.
by the way,
What is the algorithm's time complexity.

@fulmicoton
Copy link
Owner

Building the automaton can be exponential in time and memory with the number of pattern you have.
Running it is linear with your input and independent from the number of patterns you have.

@theunreal
Copy link

theunreal commented Apr 1, 2020

@fulmicoton I have the same issue, not sure what's wrong:
Java.util.pattern find indexes using:
Pattern versionPattern = Pattern.compile("\"version\":\\s*(\\d+)(\\.\\d)?");

But using the same pattern as above - do not work using this library, Any idea?
example string i'm searching at:

{
  "version": 2,
  "name": "stile",
  "id": "test",
  "types": [
    "testty"
  ]
}


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants