Reputation: 43
I need to select with regex the first sentence (all text to the first dot) of each question. And then in repleace I add $1 to put this tag
I try this but select whole text, not only the first sentence.
^[a-zA-Z].*
I have an example:
Cómo se hace para formatear una PC? Haz click sobre el botón de inicio. Selecciona la rueda dentada para acceder a Ajustes del Sistema. Pulsa sobre Actualización y Seguridad. En la pestaña de Restaurar, haz click en Comenzar o Empezar. En la ventana que se abre, selecciona Restablecer Ajustes de Fábrica.
¿Cómo formatear mi PC windows 10 a estado de fábrica? Haz click sobre el botón de inicio. Selecciona la rueda dentada para acceder a Ajustes del Sistema. Pulsa sobre Actualización y Seguridad. En la pestaña de Restaurar, haz click en Comenzar o Empezar. En la ventana que se abre, selecciona Restablecer Ajustes de Fábrica.
And this is what I need.
Cómo se hace para formatear una PC? Haz click sobre el botón de inicio. Selecciona la rueda dentada para acceder a Ajustes del Sistema. Pulsa sobre Actualización y Seguridad. En la pestaña de Restaurar, haz click en Comenzar o Empezar. En la ventana que se abre, selecciona Restablecer Ajustes de Fábrica.
¿Cómo formatear mi PC windows 10 a estado de fábrica? Haz click sobre el botón de inicio. Selecciona la rueda dentada para acceder a Ajustes del Sistema. Pulsa sobre Actualización y Seguridad. En la pestaña de Restaurar, haz click en Comenzar o Empezar. En la ventana que se abre, selecciona Restablecer Ajustes de Fábrica.
I try a lot of features but I'm so bad with regex and I couldn't select that.
Upvotes: 0
Views: 39
Reputation: 21
You may try this pattern, this won't include the question mark and dot, and uses lazy to only put bold marks around the first sentence:
Replace(r"(?<=\?)(.*?)(?<=\.)","<b>\1<b>")
Upvotes: 0