package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)(?m)^(\h*)maxlength:(?:\R\1(?!\h*maxlength_js_enforce:)(\h+).*)*$(?!\R\1\h)`)
var str = `uuid: e3737897-ae40-4771-8aff-33d2fe76eeee
langcode: de
status: true
dependencies:
config:
- config_pages.type.chatbot
- field.field.config_pages.chatbot.field_2click_solution_label
- field.field.config_pages.chatbot.field_2click_solution_logo
- field.field.config_pages.chatbot.field_2click_solution_popup_text
- field.field.config_pages.chatbot.field_title_div
- field.field.config_pages.chatbot.field_url
module:
- field_group
- field_states_ui
- file
- link
- link_field_tweak
- maxlength
- text
third_party_settings:
field_group:
group_struktur_definitionen:
children:
- group_tab_settings
- group__tab_policy
label: 'Chatbot Einstellungen'
region: content
parent_name: ''
weight: 1
format_type: tabs
format_settings:
classes: ''
show_empty_fields: false
id: ''
direction: horizontal
width_breakpoint: 640
group_tab_settings:
children:
- field_url
- field_2click_solution_logo
- field_title_div
label: Einstellungen
region: content
parent_name: group_struktur_definitionen
weight: 20
format_type: tab
format_settings:
classes: ''
show_empty_fields: false
id: ''
formatter: closed
description: ''
required_fields: true
group__tab_policy:
children:
- field_2click_solution_label
- field_2click_solution_popup_text
label: Datenschutzhinweis
region: content
parent_name: group_struktur_definitionen
weight: 21
format_type: tab
format_settings:
classes: ''
show_empty_fields: false
id: ''
formatter: closed
description: ''
required_fields: true
id: config_pages.chatbot.default
targetEntityType: config_pages
bundle: chatbot
mode: default
content:
field_2click_solution_label:
type: string_textfield
weight: 22
region: content
settings:
size: 60
placeholder: ''
third_party_settings:
field_states_ui:
form:
type: ''
list: ''
add: Hinzufügen
maxlength:
maxlength_js: 60
maxlength_js_label: 'Inhalt auf @limit Zeichen begrenzt, verbleibend: <strong>@remaining</strong><br><br>'
field_2click_solution_logo:
type: file_generic
weight: 22
region: content
settings:
progress_indicator: throbber
third_party_settings: { }
field_2click_solution_popup_text:
type: text_textarea
weight: 23
region: content
settings:
rows: 5
placeholder: ''
third_party_settings:
field_states_ui:
form:
type: ''
list: ''
maxlength:
maxlength_js: null
maxlength_js_label: 'Inhalt auf @limit Zeichen begrenzt, verbleibend: <strong>@remaining</strong>'
maxlength_js_enforce: true
maxlength_js_truncate_html: false
field_title_div:
type: string_textfield
weight: 23
region: content
settings:
size: 60
placeholder: ''
third_party_settings: { }
field_url:
type: link_default
weight: 21
region: content
settings:
placeholder_url: 'URL zu einer JavaScript Datei'
placeholder_title: ''
third_party_settings:
field_states_ui:
form:
type: ''
list: ''
add: Hinzufügen
link_field_tweak:
uri_part_custom_help: false
uri_part_custom_help_text: ''
maxlength:
maxlength_js: null
maxlength_js_label: 'Inhalt auf @limit Zeichen begrenzt, verbleibend: <strong>@remaining</strong>'
hidden:
label: true
path: true
`
var substitution = "$0\n$1$2maxlength_js_enforce: true"
fmt.Println(re.ReplaceAllString(str, substitution))
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Golang, please visit: https://golang.org/pkg/regexp/