diff --git a/docs/src/api/params.md b/docs/src/api/params.md
index 97a1f1da3c..14346d79c9 100644
--- a/docs/src/api/params.md
+++ b/docs/src/api/params.md
@@ -886,7 +886,7 @@ Slows down Playwright operations by the specified amount of milliseconds. Useful
## locator-option-has-text
- `hasText` <[string]|[RegExp]>
-Matches elements containing specified text somewhere inside, possibly in a child or a descendant element.
+Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. When passed a [string], matching is case-insensitive and searches for a substring.
For example, `"Playwright"` matches `Playwright
`.
## locator-option-has
diff --git a/docs/src/selectors.md b/docs/src/selectors.md
index 93c7838a6d..abb09ad393 100644
--- a/docs/src/selectors.md
+++ b/docs/src/selectors.md
@@ -310,7 +310,7 @@ Text selector has a few variations:
await page.Locator("text=/Log\\s*in/i").ClickAsync();
```
-- `article:has-text("Playwright")` - the `:has-text()` pseudo-class can be used inside a [css] selector. It matches any element containing specified text somewhere inside, possibly in a child or a descendant element. For example, `article:has-text("Playwright")` matches `Playwright
`.
+- `article:has-text("Playwright")` - the `:has-text()` pseudo-class can be used inside a [css] selector. It matches any element containing specified text somewhere inside, possibly in a child or a descendant element. Matching is case-insensitive and searches for a substring. For example, `article:has-text("Playwright")` matches `Playwright
`.
Note that `:has-text()` should be used together with other `css` specifiers, otherwise it will match all the elements containing specified text, including the `
`.
```js
@@ -476,7 +476,7 @@ Consider a page with two buttons, first invisible and second visible.
### Filter by text
-Locators support an option to only select elements that have some text somewhere inside, possibly in a descendant element.
+Locators support an option to only select elements that have some text somewhere inside, possibly in a descendant element. Matching is case-insensitive and searches for a substring.
```js
await page.locator('button', { hasText: 'Click me' }).click();
@@ -494,6 +494,8 @@ Locators support an option to only select elements that have some text somewhere
await page.Locator("button", new PageLocatorOptions { HasText = "Click me" }).ClickAsync();
```
+You can also pass a regular expression.
+
### Filter by another locator
Locators support an option to only select elements that have a descendant matching antoher locator.
diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.ts
index 837b8e15c3..8a53bbd039 100644
--- a/packages/playwright-core/types/types.d.ts
+++ b/packages/playwright-core/types/types.d.ts
@@ -2625,8 +2625,9 @@ export interface Page {
has?: Locator;
/**
- * Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. For example,
- * `"Playwright"` matches `Playwright
`.
+ * Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. When passed a
+ * [string], matching is case-insensitive and searches for a substring. For example, `"Playwright"` matches
+ * `Playwright
`.
*/
hasText?: string|RegExp;
}): Locator;
@@ -5443,8 +5444,9 @@ export interface Frame {
has?: Locator;
/**
- * Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. For example,
- * `"Playwright"` matches `Playwright
`.
+ * Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. When passed a
+ * [string], matching is case-insensitive and searches for a substring. For example, `"Playwright"` matches
+ * `Playwright
`.
*/
hasText?: string|RegExp;
}): Locator;
@@ -9405,8 +9407,9 @@ export interface Locator {
has?: Locator;
/**
- * Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. For example,
- * `"Playwright"` matches `Playwright
`.
+ * Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. When passed a
+ * [string], matching is case-insensitive and searches for a substring. For example, `"Playwright"` matches
+ * `Playwright
`.
*/
hasText?: string|RegExp;
}): Locator;
@@ -13879,8 +13882,9 @@ export interface FrameLocator {
has?: Locator;
/**
- * Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. For example,
- * `"Playwright"` matches `Playwright
`.
+ * Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. When passed a
+ * [string], matching is case-insensitive and searches for a substring. For example, `"Playwright"` matches
+ * `Playwright
`.
*/
hasText?: string|RegExp;
}): Locator;