Line return
-
I want to show on screen a long text already program in my lines, but want to make return to get a better view an understanding for the user.
What are the expression that I have to get in my line to get those force return line?
example of line
<property name=“ServerLoginConfirmationText” value=“For in game information, be please to ask question to ingame admin, those are; XXXXX, YYYY, ZZZZZ” />What I want to be show
For in game information, be please to ask question to ingame admin,
those are;
XXXXX,
YYYY,
ZZZZZHow do i edit my line to get result?
-
@Sylvain-Jean said in Line return:
What are the expression that I have to get in my line to get those force return line?
In the Replace With field,
\r\n
will insert a Windows newline sequence (CRLF) when you are in Search Mode > Regular Expression, so you would have to craft your Find What in such a manner that it finds the right spots to insert the newline sequence. I cannot tell from your example how to decide where the newline goes, but this should get you started.Also, please note, you appear to be trying to edit XML with regular expressions, which is a bad idea.
----
Useful References
-
@Sylvain-Jean said in Line return:
I want to show on screen a long text already program in my lines, but want to make return to get a better view an understanding for the user.
What are the expression that I have to get in my line to get those force return line?
If I understand your question, this depends entirely on what program is displaying the text to the user. It really has nothing to do with Notepad++.
I don’t want to encourage going off-topic for this forum, but perhaps if you could tell us what program is being used to display this data, we could point you toward someplace that might be able to help.
-
@Sylvain-Jean, is this a Notepad++ question or a regular expression question? This forum’s focus is supporting the Notepad++ editor, and at times people have questions about Notepad++'s search/replace feature.
If you are using using Notepad++ then you may be interested in the Generic Regex: Replacing in a specific zone of text article.
However, I personally don’t think what you want can be done in a single search replace as you want to do several things.
- You want search/replace the string
<property name="ServerLoginConfirmationText" value="
with nothing. - You want to keep the string
For in game information, be please to ask question to ingame admin
- You want to replace the comma-space that is after
admin
at the end of the previous string with a comma-newline. - You then want to replace the spaces that follow comma or semicolon with a newline up until the
" />
- You want to replace the
" />
with nothing.
Before proceeding further, I suspect you should think more carefully about what you are asking for. That’s because while it can be done in two steps they are are rather specific to the example data you had provided:
Search:
(?-i)(?:<property name="ServerLoginConfirmationText" value="|" />)
Replace: (nothing)The string is now:
For in game information, be please to ask question to ingame admin, those are; XXXXX, YYYY, ZZZZZ
and so we then deal with that using:Search:
(?-is)(?-i:For in game information, be please to ask question to ingame admin|(?!\A)\G).*?\K(?-i:(?<=[,;])\x20)
Replace:\r\n
The latter expression is straight from the article I linked to above using
(?-s)(?-i:BSR|(?!\A)\G).*?\K(?-i:FR)
whereBSR
isFor in game information, be please to ask question to ingame admin
FR
is(?<=[,;])\x20
The BSR is longer than you’d think as you wanted to preserve the comma-space in that string.
- You want search/replace the string