|
Tomalla
Designer
General Modder
Posts: 525
|
Post by Tomalla on Oct 25, 2018 9:57:16 GMT -8
On a side note I was not the only one suggesting Notepad++ (as swietymiki pointed out). In 2014 Friedslick6 proposed its use here and over a year later Zu did just the same in this post. For some reason however it was my post which was the most persuasive
|
|
GooRoo
Administrator
Owner Administrator
I luv Gruntz!
Posts: 7,425
Display Name: GooRoo
|
Post by GooRoo on Oct 25, 2018 10:11:00 GMT -8
On a side note I was not the only one suggesting Notepad++ (as swietymiki pointed out). In 2014 Friedslick6 proposed its use here and over a year later Zu did just the same in this post. For some reason however it was my post which was the most persuasive Yours was probably the most persuasive because of your errata list for the Gruntz Level Editor Manual, and the effort I spent with the (totally inadequate, it seems) bundled NotePad. Currency was the key ... I was currently in need of something better.
|
|
|
Post by Perfect Grunt on Oct 29, 2018 11:23:10 GMT -8
I could have told you that YEARS ago! :-P
I really like N++, and I love the option to edit column-wise (you've already found that, GooRoo?). And as a computer scientist, I loooooove Regular Expressionz!
|
|
GooRoo
Administrator
Owner Administrator
I luv Gruntz!
Posts: 7,425
Display Name: GooRoo
|
Post by GooRoo on Oct 29, 2018 13:05:35 GMT -8
I could have told you that YEARS ago! :-P I really like N++, and I love the option to edit column-wise (you've already found that, GooRoo?). And as a computer scientist, I loooooove Regular Expressionz! I am considering experimenting with scripts, since there are so many things I (now) have to do when updating HTML elements. Such as removing BOLD tags, changing TDs to THs (for automatic BOLDing ... a little less storage in multi-column tables) even with adding align="left" into the <tr...> tags. And then I can read without squinting.
And for things on this Forum, I need to find a color combination that is far more readable than red or dark red on this background. My dilemma is to find a color not already in use for other special things. orange for instance is a bit more readable, but already 'spoken for' for Gruntzy things.
|
|
|
Post by Perfect Grunt on Oct 30, 2018 11:50:48 GMT -8
Remove bold tags? Replace
\[b\](.*?)\[/b\] with \1
|
|
GooRoo
Administrator
Owner Administrator
I luv Gruntz!
Posts: 7,425
Display Name: GooRoo
|
Post by GooRoo on Oct 30, 2018 12:51:01 GMT -8
Remove bold tags? Replace \[b\](.*?)\[/b\] with \1 All of my HTML BOLD tags are <b> and </b>, with UBBC the same except square angle braces instead of less than and greater than. I don't understand what the back slashes and *? are for in the find argument and why the 1 in the replacement argument?
|
|
GooRoo
Administrator
Owner Administrator
I luv Gruntz!
Posts: 7,425
Display Name: GooRoo
|
Post by GooRoo on Oct 30, 2018 15:11:08 GMT -8
In many programming languages, the back slash character \ is an 'escape' character, signifying there is an unusual meaning to the next character: therefore, I presume the sequence is "ignore special usage of the [", the b is 'normal' and "ignore special usage of the ]" (three ordinary characters). The same string is to allow the end tag to also be treated as four ordinary characters. My guess is that the string in the middle is a 'connector' to say "and also do this". But the final \1 eludes me as to what that will do.
|
|
Tomalla
Designer
General Modder
Posts: 525
|
Post by Tomalla on Oct 31, 2018 1:53:17 GMT -8
In many programming languages, the back slash character \ is an 'escape' character, signifying there is an unusual meaning to the next character: therefore, I presume the sequence is "ignore special usage of the [", the b is 'normal' and "ignore special usage of the ]" (three ordinary characters). The same string is to allow the end tag to also be treated as four ordinary characters. My guess is that the string in the middle is a 'connector' to say "and also do this". But the final \1 eludes me as to what that will do. Yes, they're escape characters indeed - since square brackets are a part of the syntax they need to be escaped in order to be treated literally. Each of the two expressions Perfect Grunt provided is a regular expressions (or regexp for short). You can Google it and get a multitude of tutorials what they are and what it allows you to achieve (including what square brackets are for). I'll just elaborate briefly on your question: the "\1" part is not an escape character like you might have though initially. It's a reference to a capture group. In the first expression you have: \[b\](.*?)\[/b\]Notice the parenthesis. The "find" feature alone does not really need them and can work without it as well. So if you wanted to find all of the ... tags you might as well just type in: \[b\].*?\[/b\] and all occurrences would be found. However when you want to replace just a PART of a found text you have to specify exactly which part you want to alter specifically. That's what the parenthesis are for - they mark a capture group. In this case a capture group represents the text in between and tags. Then in the "Replace with" text box the \1 means: replace the entire ... tag with just its contents and thus discard the and bits. The \1 bit means the first left-most capture group. And so if you had more capture groups you would refer to them by \1, \2 ... and so on. PS.: if you find the replace feature not working, make sure you have the "Regular expression" radio button checked in the "Search mode" section. It's in the bottom-left part of the "Replace" dialog.
|
|
|
|
Post by Perfect Grunt on Oct 31, 2018 11:43:15 GMT -8
I can elaborate a bit at my regex, GooRoo, I think it might come in handy for you when you have to edit loads of text:
In regular expressionz, the square brackets are a "find any of these" operator. Search for [ou] and replace with "y" makes "Honolulu" to "Hynylyly". So, to search a square bracket, it needs a backslash.
Search:
\[b\](.*?)\[/b\] ^^^^^ Search for the exact text "[b]", followed by... ^ ^ Whatever you find within these, remember it! ^ ...any possible character ("." finds every character!) ^^ (repeat this as least often as possible), followed by... ^^^^^^ ...the exact text "[/b]".
Replace it with: \1 The thing you remembered while searching.
If you have the text
I say [b]hello[/b], my friend [b]Casimir[/b] the second!
and do a "Replace all", it finds "[b]hello[/b]" and replaces it with "hello", and it finds "[b]Casimir[/b]" and replaces it with "Casimir".
Quite important is the "?" after the "*". When you leave it out, the * gets "greedy" at this point. It finds "[b]hello[/b], my friend [b]Casimir[/b]" and replaces it with "hello[/b], my friend [b]Casimir".
Regular expressionz are one of the most powerful tools in the daily life of a computer scientist. :-)
|
|