diff --git a/docs/sources/panels-visualizations/query-transform-data/transform-data/index.md b/docs/sources/panels-visualizations/query-transform-data/transform-data/index.md index b4d9c946bba..7d628524023 100644 --- a/docs/sources/panels-visualizations/query-transform-data/transform-data/index.md +++ b/docs/sources/panels-visualizations/query-transform-data/transform-data/index.md @@ -1165,15 +1165,17 @@ This flexible transformation simplifies the process of consolidating and summari Use this transformation to rename parts of the query results using a regular expression and replacement pattern. -You can specify a regular expression, which is only applied to matches, along with a replacement pattern that support back references. For example, let's imagine you're visualizing CPU usage per host and you want to remove the domain name. You could set the regex to '([^.]+)..+' and the replacement pattern to '$1', 'web-01.example.com' would become 'web-01'. +You can specify a regular expression, which is only applied to matches, along with a replacement pattern that support back references. For example, let's imagine you're visualizing CPU usage per host and you want to remove the domain name. You could set the regex to '/^([^.]+).\*/' and the replacement pattern to '$1', 'web-01.example.com' would become 'web-01'. -In the following example, we are stripping the prefix from event types. In the before image, you can see everything is prefixed with 'system.' +> **Note:** The Rename by regex transformation was improved in Grafana v9.0.0 to allow global patterns of the form '//g'. Depending on the regex match used, this may cause some transformations to behave slightly differently. You can guarantee the same behavior as before by wrapping the match string in forward slashes '(/)', e.g. '(._)' would become '/(._)/'. -{{< figure src="/static/img/docs/transformations/rename-by-regex-before-7-3.png" class="docs-image--no-shadow" max-width= "1100px" alt="A bar chart with long series names" >}} +In the following example, we are stripping the 'A-' prefix from field names. In the before image, you can see everything is prefixed with 'A-': + +{{< figure src="/media/docs/grafana/panels-visualizations/screenshot-rename-by-regex-before-v11.0.png" class="docs-image--no-shadow" max-width= "1100px" alt="A time series with full series names" >}} With the transformation applied, you can see we are left with just the remainder of the string. -{{< figure src="/static/img/docs/transformations/rename-by-regex-after-7-3.png" class="docs-image--no-shadow" max-width= "1100px" alt="A bar chart with shortened series names" >}} +{{< figure src="/media/docs/grafana/panels-visualizations/screenshot-rename-by-regex-after-v11.0.png" class="docs-image--no-shadow" max-width= "1100px" alt="A time series with shortened series names" >}} This transformation lets you to tailor your data to meet your visualization needs, making your dashboards more informative and user-friendly. diff --git a/public/app/features/transformers/docs/content.ts b/public/app/features/transformers/docs/content.ts index 2af78f25338..c7331f55bc6 100644 --- a/public/app/features/transformers/docs/content.ts +++ b/public/app/features/transformers/docs/content.ts @@ -1249,22 +1249,24 @@ This flexible transformation simplifies the process of consolidating and summari return ` Use this transformation to rename parts of the query results using a regular expression and replacement pattern. -You can specify a regular expression, which is only applied to matches, along with a replacement pattern that support back references. For example, let's imagine you're visualizing CPU usage per host and you want to remove the domain name. You could set the regex to '([^\.]+)\..+' and the replacement pattern to '$1', 'web-01.example.com' would become 'web-01'. +You can specify a regular expression, which is only applied to matches, along with a replacement pattern that support back references. For example, let's imagine you're visualizing CPU usage per host and you want to remove the domain name. You could set the regex to '/^([^.]+).*/' and the replacement pattern to '$1', 'web-01.example.com' would become 'web-01'. -In the following example, we are stripping the prefix from event types. In the before image, you can see everything is prefixed with 'system.' +> **Note:** The Rename by regex transformation was improved in Grafana v9.0.0 to allow global patterns of the form '//g'. Depending on the regex match used, this may cause some transformations to behave slightly differently. You can guarantee the same behavior as before by wrapping the match string in forward slashes '(/)', e.g. '(.*)' would become '/(.*)/'. + +In the following example, we are stripping the 'A-' prefix from field names. In the before image, you can see everything is prefixed with 'A-': ${buildImageContent( - '/static/img/docs/transformations/rename-by-regex-before-7-3.png', + '/media/docs/grafana/panels-visualizations/screenshot-rename-by-regex-before-v11.0.png', imageRenderType, - 'A bar chart with long series names' + 'A time series with full series names' )} With the transformation applied, you can see we are left with just the remainder of the string. ${buildImageContent( - '/static/img/docs/transformations/rename-by-regex-after-7-3.png', + '/media/docs/grafana/panels-visualizations/screenshot-rename-by-regex-after-v11.0.png', imageRenderType, - 'A bar chart with shortened series names' + 'A time series with shortened series names' )} This transformation lets you to tailor your data to meet your visualization needs, making your dashboards more informative and user-friendly.