I'm using Sublime Text 3.2.2, and I really enjoy this feature:
// Highlights other occurrences of the currently selected text
"match_selection": true,
But there's a situation where this feature doesn't work for me - It's when my string has the # character:
TEST #TEST #
TEST #TEST
123 #123 123 #123
TEST #TEST #
Could you test please? Have you ever noticed that? Can we adjust this?
OBS:
my word separators for this syntax: "word_separators": "~!$%^&*|+=`~,()[]{}"
The same seems to occur with the ? character
Related
I am trying to edit with two conditions in the vi.
example text)
hello world!
-apple watermelon
test text
two condition must be met.
start with -
I want to replace only the first letter of a word with a html tag (The first letter may not be the alphabet)
I tried substitution via pipe in vi, but i cant
Expected
hello world!
-<b>a</b>pple <b>w<b>atermelon
test text
You can use
:g/^-/s#\<\(.\)#<b>\1</b>#g
Meaning:
for every line that starts with - (:g/^-/)
substitute
the first character after a break (\<\(.\)) (while capturing it)
replace it with <b>\1</b> (\1 referencing the captured value)
multiple times per line (the g flag, remove this unless :set gdefault? returns nogdefault)
so I'm not even sure if what I am trying to do is possible or not. I have a huge file, each line of the file has some record in it and there are some 20k lines. Few of the lines have some variables wrapped in double underscores like this:
abc def __var1__.
Only a few lines would have multiple variables in the same line. Something like:
abc def __var1__ ghi jkl __var2__. zyx...
Now, I am wondering if I could search for those lines. I tried this search pattern:
/__*__*__*__ (didn't work)
/__**__ (this also didn't work)
Could you please help me here. I am sure there would be some sort of wildcard character to do this.
Okay, I found a way around(not sure if that's the best way though):
/".\+__.\+__.\+__.\+__.
Here is the explaination:
" => My Line starts with double quote
.\+__ => Any Char until "__"
And this way I check if the line has more than or equal to 3 "__".
MY CODE
def SimplePrint():
print("""LINE 1
LINE 2
LINE 3""")
SimplePrint()
OUTPUT
LINE 1
LINE 2
LINE 3
DESIRED OUTPUT
LINE 1
LINE 2
LINE 3
It Works When I Make The Following Changes To My Code :
def SimplePrint():
print("""LINE 1
LINE 2
LINE 3""")
SimplePrint()
This However, Disturbs The Indentation.
I Was Wondering If There's Another Way To Do It.
Most of the IDE add the indentation when you press Enter but your python multi line(i.e triple quote) string which is one single string treat the indentation added by the IDE as part of it's literal behavior.
Understand it this way IDE add the space or tab automatically but python interpreter treat that indentation as space or tab due to multiline string.
print("""this is demo
<space/tab>behavior of multi line string""")
Solution: Just escape that indentation added by IDE automatically.
print("""this is happy demo
behavior of multi line string""")
I am having a text file
Example:
793643450715275|Andriod Game Hacker
470734673064253|Andriod Firmရာ
382409221961101|Andriod Solution
709215912481252|AndriodوIOS
248027618719895|Exchange App Andriod Reviews
212241765574268|andrioders
I want to remove all alphabet characters
Example Like :
793643450715275
470734673064253
382409221961101
709215912481252
248027618719895
212241765574268
Anybody tell me how can I do this .I have also try notepad++ but not able to do this
Suggest Me.
In Notepad++, please try Find what :
\D+
Replace with :
\r
in Regular expression Search Mode, Replace All.
In Word:
Find what:
|*^13
Replace with:
^p
check Use wildcards and Replace All.
In Excel:
=LEFT(A1,FIND("|",A1)-1)
or if number format preferred:
=1*LEFT(A1,FIND("|",A1)-1)
and in both cases copy down to suit.
Or Text to Columns with pipe as the delimiter and delete what is not required.
how to transform text block to get it in one line
for example
Hello
Sublime
Text
Editor!
should become
Hello Sublime Text Editor!
??
Thanks!
You don't need a regular expression to do this. First, select the text:
Then hit CtrlJ on Windows/Linux or ⌘J on OS X to join the lines together:
This can be done for example by running a Perl regular expression replace searching for (?:[\t ]*\r?\n[\t ]*)+ and using a single space character as replace string.
(?:...) is a non marking group.
[\t ]* finds 0 or more tabs or spaces.
\r?\n finds an optionally present carriage return and a line-feed.
And the + means 1 or more times of the regular expression in the non marking group which in other words finds optionally existing trailing whitespaces at end of a line, the line termination and optionally existing whitespaces at beginning of next line.