text = {"Donc", "j'obtiens", "<i>aᵢ₁(\[Alpha]₁ - \[Beta]₁) + aᵢ₂(\[Alpha]₂ - \
\[Beta]₂) + ... + aₙ₁(\[Alpha]ₙ - \[Beta]ₙ) = bᵢ - bᵢ = 0.</i>", \
"<i>aᵢ₁(\[Alpha]₁ - \[Beta]₁) + aᵢ₂(\[Alpha]₂ - \[Beta]₂) + ... + \
aₙ₁(\[Alpha]ₙ - \[Beta]ₙ) = bᵢ - bᵢ = 0.</i>", "Donc en particulier", \
"ça veut dire que si je multiplie par <i>c</i>", "pour tout nombre réel \
<i>c</i>"}
Now my question is:
How can I get the position of in the list of every object that starts with
<i>
?How can I replace the
<i>
at the start of that object and the</i>
at the end of that object by another string ?
By "object" I really mean a list object: for instance, I don't want the <i>
and </i>
to be replaced in "ça veut dire que si je multiplie par <i>c</i>
", since this object of the list does not start with an <i>
.
EDIT: To clear any confusion, here is how the text could look like afterwards:
"Donc", "j'obtiens", "REPLACE(\[Alpha]₁ - \[Beta]₁) + aᵢ₂(\[Alpha]₂ - \
\[Beta]₂) + ... + aₙ₁(\[Alpha]ₙ - \[Beta]ₙ) = bᵢ - bᵢ = 0.REPLACE", \
"REPLACEaᵢ₁(\[Alpha]₁ - \[Beta]₁) + aᵢ₂(\[Alpha]₂ - \[Beta]₂) + ... + \
aₙ₁(\[Alpha]ₙ - \[Beta]ₙ) = bᵢ - bᵢ = 0.REPLACE", "Donc en particulier", \
"ça veut dire que si je multiplie par <i>c</i>", "pour tout nombre réel \
<i>c</i>"
Position[text, s_String /; StringMatchQ[s, "<i>*</i>"]]
, but that won't catch the last two items with italics tags since they don't actually "start with<i>
", as the criterion you mentioned. $\endgroup$