Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

preload url fix punctuation with brackets

Magnus Müller76bd5f21d7ee
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.py
index 4a1658503..077847592 100644
--- a/browser_use/agent/service.py
+++ b/browser_use/agent/service.py
@@ -1206,7 +1206,7 @@ class Agent(Generic[Context, AgentStructuredOutput]):
if match:
url = match.group(0)
# Remove trailing punctuation that's not part of URLs
- url = re.sub(r'[.,;:!?]+$', '', url)
+ url = re.sub(r'[.,;:!?()\[\]]+$', '', url)
# Add https:// if missing
if not url.startswith(('http://', 'https://')):
url = 'https://' + url