So basically what i need is an expression to be used in the search function in sublime text.
Expression reqs - 4 consecutive space characters (\s), to replace the selected with one tab
- If there is a semicolon and it is followed by a character before the end of the line, to replace it with 7 tabs
- Extra not necessary, Replace comments that start with two forward slashes to be like this /* comment */
Not sure if these are doable or not tho
if u wanna test it https://regexr.com/
I would really appreciate any help 🤝
GIMME MY OLD AVATAR BACK :/
Sep 20, 2017 05:42 AM
(This post was last modified: Sep 20, 2017 05:46 AM by Writz.)
why is this in the visual basic and .NET framework, this is a regex that need help with, WTF, dumb fucking mod ??
is it cuz i added a Microsoft link ? they just offered a good explanation to the regex, im using regex in sublime text editor to edit code, I dont wanna say which langauge, cuz then u'll tell me to go there and ask them, you dumb fucking kid....
GIMME MY OLD AVATAR BACK :/
Sep 20, 2017 12:16 PM
(This post was last modified: Sep 22, 2017 03:07 AM by Owl.)
Some possibilities:
1. /\s{4}/
2. /;\s*/
3. /\/\/\s*(.*?)$/m (capture group 1)
(Sep 20, 2017 12:16 PM)Owl Wrote: Some possibilities:
1. /\s{4}/
2. /;\s+?$/m
3. /\/\/(.*?)$/m (capture group 1)
Thank you so much for replying, but the first one worked on tabs and spaces, and also worked for less than 4 spaces, 2nd and 3rd didnt work at all, im using this website to test them tho
GIMME MY OLD AVATAR BACK :/
Then type a space instead of \s because \s includes other whitespace, which would include '\n'.
(Sep 21, 2017 08:05 PM)Writz Wrote: Thank you so much for replying, but the first one worked on tabs and spaces, and also worked for less than 4 spaces, 2nd and 3rd didnt work at all, im using this website to test them tho
What input are you testing against? I made a couple of adjustments to the expressions above.
(Sep 22, 2017 03:08 AM)Owl Wrote: What input are you testing against? I made a couple of adjustments to the expressions above.
Orka - \s means space, but just as much as "whitespace". If he wants to exclude tabs and such you can't use this.
Sep 22, 2017 08:26 AM
(This post was last modified: Sep 22, 2017 08:26 AM by Barret.)
(Sep 22, 2017 08:23 AM)0xDEAD10CC Wrote: Orka - \s means space, but just as much as "whitespace". If he wants to exclude tabs and such you can't use this.
Yeah this confuses many, they assume space is space and not a tab or crlf's, but they are treated the same.
(Sep 22, 2017 08:23 AM)0xDEAD10CC Wrote: Orka - \s means space, but just as much as "whitespace". If he wants to exclude tabs and such you can't use this. (Sep 22, 2017 08:26 AM)Barret Wrote: Yeah this confuses many, they assume space is space and not a tab or crlf's, but they are treated the same.
From his requests it seems he was attempting a parser for code, so I went with \s to account for all forms of whitespace.
Sep 22, 2017 12:10 PM
(This post was last modified: Sep 22, 2017 12:11 PM by System[X].)
try using the + key for more than 1 like (\s+), this will do 1 space or many. also (\n) for a single new line or (\n+) for many
Thanks
I found a way to ask regex to specifically target spaces, it's \x20 instead of \s
20 is the hex code for 'space', 09 is the hex code for tab.
but this still doesn't get me any closer to what i really need..
GIMME MY OLD AVATAR BACK :/
(Sep 23, 2017 09:36 AM)Writz Wrote: I found a way to ask regex to specifically target spaces, it's \x20 instead of \s
20 is the hex code for 'space', 09 is the hex code for tab.
but this still doesn't get me any closer to what i really need..
Show us what you want, the string and we will give you the best regex for it.
Thanks
(Sep 23, 2017 09:36 AM)Writz Wrote: I found a way to ask regex to specifically target spaces, it's \x20 instead of \s
20 is the hex code for 'space', 09 is the hex code for tab.
but this still doesn't get me any closer to what i really need..
I already just told you this, and you don't need the hex escape character, you can just use a space...
|