"git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "116f70cbf803c2e3dea2c042d01470ef2396ff9b"
Unverified Commit 8f99f165 authored by drbh's avatar drbh Committed by GitHub
Browse files

fix: improve regex expression (#2468)

parent 21187c27
...@@ -157,7 +157,12 @@ from huggingface_hub import InferenceClient ...@@ -157,7 +157,12 @@ from huggingface_hub import InferenceClient
client = InferenceClient("http://localhost:3000") client = InferenceClient("http://localhost:3000")
regexp = "((25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(25[0-5]|2[0-4]\\d|[01]?\\d\\d?)" section_regex = "(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"
regexp = f"HELLO\.{section_regex}\.WORLD\.{section_regex}"
# This is a more realistic example of an ip address regex
# regexp = f"{section_regex}\.{section_regex}\.{section_regex}\.{section_regex}"
resp = client.text_generation( resp = client.text_generation(
f"Whats Googles DNS? Please use the following regex: {regexp}", f"Whats Googles DNS? Please use the following regex: {regexp}",
...@@ -170,7 +175,7 @@ resp = client.text_generation( ...@@ -170,7 +175,7 @@ resp = client.text_generation(
print(resp) print(resp)
# 7.1.1.1 # HELLO.255.WORLD.255
``` ```
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment