Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(replay): say that URL trigger patterns are tested against the full URL (#113931)

leonhardprinzb9c27e1bc726
diff --git a/frontend/src/lib/components/IngestionControls/triggers/UrlConfig.tsx b/frontend/src/lib/components/IngestionControls/triggers/UrlConfig.tsx
index 53803c55dc69..5eccbe08189b 100644
--- a/frontend/src/lib/components/IngestionControls/triggers/UrlConfig.tsx
+++ b/frontend/src/lib/components/IngestionControls/triggers/UrlConfig.tsx
@@ -88,12 +88,12 @@ export function UrlConfig({
{!props.isAddFormVisible && props.config && props.config.length > 0 && (
<div className="border rounded p-3 bg-surface-primary">
<LemonLabel className="text-sm font-medium mb-2 block">
- Test a URL against these patterns:
+ Test a full URL against these patterns:
</LemonLabel>
<LemonInput
value={checkUrl}
onChange={setCheckUrl}
- placeholder="Enter a URL to test (e.g., https://example.com/page)"
+ placeholder="e.g., https://example.com/checkout?step=2"
data-attr="url-check-input"
className="mb-2"
/>
@@ -102,7 +102,10 @@ export function UrlConfig({
{Object.values(checkUrlResults).some(Boolean) ? (
<span className="text-success">✓ This URL matches at least one pattern</span>
) : (
- <span className="text-danger">✗ This URL doesn't match any patterns</span>
+ <span className="text-danger">
+ ✗ This URL doesn't match any patterns. Patterns match the full URL, so a path on its
+ own never matches.
+ </span>
)}
</div>
)}
@@ -268,14 +271,18 @@ function UrlConfigForm({
>
<div className="flex flex-col gap-2 w-full">
<LemonBanner type="info" className="text-sm">
- We always wrap the URL regex with anchors to avoid unexpected behavior (if you do not). This is
- because <pre className="inline">https://example.com/</pre> does not only match the homepage. You'd
- need <pre className="inline">^https://example.com/$</pre>
+ Patterns are wrapped in <code className="inline">^</code> and <code className="inline">$</code> and
+ matched against the full URL, so a path on its own never matches. Write the full URL, e.g.{' '}
+ <code className="inline">https://example.com/checkout.*</code>
</LemonBanner>
<LemonLabel className="w-full">
Matching regex:
<LemonField name="url" className="flex-1">
- <LemonInput autoFocus placeholder="Enter URL regex." data-attr="url-input" />
+ <LemonInput
+ autoFocus
+ placeholder="e.g., https://example.com/checkout.*, ^https://example.com/page$"
+ data-attr="url-input"
+ />
</LemonField>
</LemonLabel>
{validationWarning && <span className="text-danger">{validationWarning}</span>}
diff --git a/frontend/src/lib/components/IngestionControls/triggers/triggerGroups/TriggerGroupsEditor.tsx b/frontend/src/lib/components/IngestionControls/triggers/triggerGroups/TriggerGroupsEditor.tsx
index 34a1f979cd42..f9201209ce7a 100644
--- a/frontend/src/lib/components/IngestionControls/triggers/triggerGroups/TriggerGroupsEditor.tsx
+++ b/frontend/src/lib/components/IngestionControls/triggers/triggerGroups/TriggerGroupsEditor.tsx
@@ -436,10 +436,10 @@ function GroupForm({ group, onSave, onCancel }: GroupFormProps): JSX.Element {
{isAddingUrl && (
<div className="border rounded p-3 bg-bg-3000 mb-2">
<LemonBanner type="info" className="text-sm mb-2">
- We always wrap the URL regex with anchors to avoid unexpected behavior (if you do
- not). This is because <code className="inline">https://example.com/</code> does not
- only match the homepage. You'd need{' '}
- <code className="inline">^https://example.com/$</code>
+ Patterns are wrapped in <code className="inline">^</code> and{' '}
+ <code className="inline">$</code> and matched against the full URL, so a path on its
+ own never matches. Write the full URL, e.g.{' '}
+ <code className="inline">https://example.com/checkout.*</code>
</LemonBanner>
<LemonLabel>Matching regex:</LemonLabel>
<div className="flex gap-2 mt-1">
@@ -447,7 +447,7 @@ function GroupForm({ group, onSave, onCancel }: GroupFormProps): JSX.Element {
value={newUrl}
onChange={setNewUrl}
onPressEnter={() => addUrl(newUrl)}
- placeholder="e.g., /checkout/.*, ^https://example.com/page$"
+ placeholder="e.g., https://example.com/checkout.*, ^https://example.com/page$"
fullWidth
autoFocus
/>
@@ -461,12 +461,12 @@ function GroupForm({ group, onSave, onCancel }: GroupFormProps): JSX.Element {
{triggerGroup.urls.length > 0 && (
<div className="mt-3 pt-3 border-t">
<LemonLabel className="text-xs mb-1 block">
- Test a URL against existing patterns:
+ Test a full URL against existing patterns:
</LemonLabel>
<LemonInput
value={testUrl}
onChange={setTestUrl}
- placeholder="Enter a URL to test (e.g., https://example.com/page)"
+ placeholder="e.g., https://example.com/checkout?step=2"
fullWidth
size="small"
/>
@@ -482,7 +482,10 @@ function GroupForm({ group, onSave, onCancel }: GroupFormProps): JSX.Element {
}) ? (
<span className="text-success">Matches at least one pattern</span>
) : (
- <span className="text-danger">Doesn't match any patterns</span>
+ <span className="text-danger">
+ Doesn't match any patterns. Patterns match the full URL, so a
+ path on its own never matches.
+ </span>
)}
</div>
)}