Is there a trim trailing spaces option in ZeroBrane Studio? - trim

I want the IDE to trim my trailing spaces in my code like I have Notepad++ set to do. Is this possible?

Yes; there is a plugin that enables that: https://github.com/pkulchenko/ZeroBranePackage/blob/master/striptrailingwhitespace.lua.

Related

Replace text between brackets and carraige returns in Atom.io

I'm using Atom.io to edit a text transcription of an interview for qualitative analysis.
Here's a sample line:
[30-Aug-19 03:48 PM] Interviewer
See you in 10.
How do I edit it so that it looks like this:
Interviewer: See you in 10.
i.e. remove the text between the square brackets and the square brackets themselves, replace the carriage return with a semi-colon and space.
I have tried looking in the atom manual, tried looking at regex expressions and I can't even begin to get my head round them (not much of a programmer, and not Javascript at all).
You need to use the search & replace with the regex mode
Activate the regex mode, then search for \[.*? Interviewer and replace by Interviewer:, it should do the trick

RegEx for Client-Side Validation of FileUpload

I'm trying to create a RegEx Validator that checks the file extension in the FileUpload input against a list of allowed extensions (which are user specified). The following is as far as I have got, but I'm struggling with the syntax of the backward slash (\) that appears in the file path. Obviously the below is incorrect because it just escapes the (]) which causes an error. I would be really grateful for any help here. There seems to be a lot of examples out there, but none seem to work when I try them.
[a-zA-Z_-s0-9:\]+(.pdf|.PDF)$
To include a backslash in a character class, you need to use a specific escape sequence (\b):
[a-zA-Z_\s0-9:\b]+(\.pdf|\.PDF)$
Note that this might be a bit confusing, because outside of character classes, \b represents a word boundary. I also assumed, that -s was a typo and should have represented a white space. (otherwise it shouldn't compile, I think)
EDIT: You also need to escape the dots. Otherwise they will be meta character for any character but line breaks.
another EDIT: If you actually DO want to allow hyphens in filenames, you need to put the hyphen at the end of the character class. Like this:
[a-zA-Z_\s0-9:\b-]+(\.pdf|\.PDF)$
You probably want to use something like
[a-zA-Z_0-9\s:\\-]+\.[pP][dD][fF]$
which is same as
[\w\s:\\-]+\.[pP][dD][fF]$
because \w = [a-zA-Z0-9_]
Be sure character - to put as very first or very last item in the [...] list, otherwise it has special meaning for range or characters, such as a-z.
Also \ character has to be escaped by another slash, even inside of [...].

Exclude dash (-) from word separators in vi

vi uses dash and space as word separators.
is there any way to exclude dash from word separators ?
This is required to work with the symbols generated by ctags exe.
when symbol contain a "-" ,vi tags fails to locate that even though symbol is generated properly.
For example
Symbol - EX01-VAR-LOCAL
when using the ctrl+] to search tag for this, vi looks only for EX01 not the complete symbol EX01-VAR-LOCAL
although if used with vi -t EX01-VAR-LOCAL or in command mode :tag EX01-VAR-LOCAL
works fine.
Thanks in advance :)
To unset dash as a word separator you have to set this as a normal character using 'iskeyword' setting.
If you look the default iskeyword content (using ":set all") you may have this:
iskeyword=#,48-57,_,192-255
The dash symbol is 45 in ASCII characters, so you have to set as normal character.
Try this:
set iskeyword=#,45,48-57,_,192-255
FZapp's answer is correct. The only thing I'd like to add is that looking at the content of iskeyword would be easier using :set iskeyword instead of :set all.

How to escape a RegEx that generates an error of “unexpected quantifier"on IE?

I use asp.net and C#. I have TextBox with an Validation Control with RegEx.
I use this code as validation.
ValidationExpression="^(?s)(.){4,128}$"
But only in IE9 I receive an error: unexpected quantifier from the javascript section.
Probably I have to escape my RegEx but I do not have any idea how to do it and what to escape.
Could you help me with a sample of code? Thanks
Write it like this instead :
^([\s\S]){4,128}$
I suspect that (?s) is the cause of the error.
Three problems: (1) JavaScript doesn't support inline modifiers like (?s), (2) there's no other way to pass modifiers in an ASP validator, and (3) neither of those facts matters, because JavaScript doesn't support single-line mode. Most people use [\s\S] to match anything-including-newlines in JavaScript regexes.
EDIT: Here's how it would look in your case:
ValidationExpression="^[\s\S]{4,128}$"
[\s\S] is a character class that matches any whitespace character (\s) or any character that's not a whitespace character--in other words, any character. The dot (.) metacharacter matches any character except a newline. Most regex flavors (like .NET's) support a "Singleline" or "DOTALL" mode that makes the dot match newlines, too, but not JavaScript.
JavaScript doesn't understand (?s) afaik, instead you can replace . with [^] or [\s\S].
Eg: ^[^]{4,128}$

Numeric textbox with regex

im trying to do a numeric textbox in asp.net using regex, and came up with:
^[^\s]+[/d]+[^\s]$
I want it to disallow leading/trailing whitespace, and allow only numbers.
Any clue why it doesnt work?
You can try this ^\d+$. \d matches digits. The one you wrote does not work because you are using /d instead of \d.
Since you want to disallow whitespace and other characters, why don't you try ^\d+$ and inverse the way of evaluation in your code?
Your regex currently means "anything but whitespace, followed by slashes and d-letters, followed by one more of anything but whitespace". A simple ^\d+$ is sufficient.

Resources