This question already has answers here:
Extended regular expressions (ERE) for .gitignore
(2 answers)
Closed 8 years ago.
I am using git in my project. My home directory contain few files like
Title v2.12.12.exe
Title v1.4.21.exe
Title v3.42.11.exe
All these starts with Title v and ends with .exe and contains some version in the middle. What changed should I made in .gitignore to ignore these types of file?
Just tried it and the simplest seem to work:
Title v*.exe
The only caveat is that you may catch more than expected like "Title v-not.a.valid.version.exe"
Related
This question already has answers here:
How to edit all lines in Visual Studio Code
(9 answers)
Closed 3 years ago.
So essentially someone on our dev team made a bit of a big issue where they had changed all of the build actions on .csproj files and we are thinking of the easiest way to change them back.
We want to use regex to open all the csproj files via VSCode. The format to open multiple files in file explorer is
"filename" "filename1" "filename2"
my list is
com.Console.job1.csproj
com.Console.job2.csproj
com.Console.job3.csproj
com.Console.job4.csproj
my current regex
(.+)\n
then my regex to replace is
"$1"\s
which doesnt work at all
You can use this regex :
To locate pattern
([^\s]+)(\n)?
To replace :
"$1"
keep in mind the replace pattern contains a space at its end
Demo :
Here
This question already has answers here:
What special characters must be escaped in regular expressions?
(13 answers)
Closed 5 years ago.
I 've a File structure "solution/"
Need a reg exp to match all the files under "solution/" Excluding .img files in the path "solution/tree/changes/sample.img"
I tried below it but of not worked
^solution\/tree\/changes\/((?!.img).)*$
Thanks in advance
You did not mention language, but this should work
^solution\/tree\/changes\/(?!.*\.img).*$
see regex101 demo: https://regex101.com/r/Y7znBy/1
Important! You need to set multilineflag
#Fallenhero My Exact requirement is I 've following file structure
solution/moon/
solution/tree/anomoly/
solution/tree/enquiry/
solution/tree/changes/space.img
solution/tree/changes/mine.txt
I've to parse a json file as input with regular expression to copy all the files in the above structure except solution/tree/changes/space.img
JSON Input which I've tried but didn't work
"^solution\/(?!tree\/).*\/*",
"^solution\/tree\/(?!changes\/).*\/*",
"^solution\/tree\/changes\/((?!.img).)*$"
Could you please provide your ideas
This question already has answers here:
Batch rename files
(9 answers)
Closed 7 years ago.
I want to rename name of files test123..-1.in, test123..-2.in, etc. to test123.in.
I tried commands:
rename -/d.in .in *.in, and many of similar but no one works(Can You explain why?).
Then i tried rename 's/.[0-9]*.in$/.in/' *.in, with same result..
Any proposition how to solve this problem in the simple way? I dont wanna write it mannualy.
Thanks for Your help.
You can use this rename:
rename 's/\.+-\d+\././' test123..-*in
or as per OP's comment below:
rename 's/-\d+\.in/.in/' *.in
This question already has answers here:
History of changes to a particular line of code in Subversion
(11 answers)
Closed 8 years ago.
I have a line in my code:
force=sizeGoalForceKappa*tanh((origRadius-v->radius)/origRadius)*(oldDist+minSpacing-v->radius)/minSpacing;
The code is at revision 881. Is there a way to see history of only this line, while ignoring other changes? Showing log for a single file ignores other files. Can I get a log for a single line, or something similar? I would like to see how definition of "force" has evolved over time, and when "force" was introduced. SVN Blame only gives me the revision in which a line was last changed.
Use svn blame, see TortoiseSVN manual. The question can be considered as the duplicate of History of changes to a particular line of code in Subversion.
Sometimes for global history of line alternative SCM and it's command may be better: I like Mercurial's grep for it (for SVN repo Mercurial CLI and hgsubversion are required)
hg grep --all PATTERN FILE will produce something like this
>hg grep --all load_theme_textdomain functions.php
functions.php:2:-:load_theme_textdomain('fiver', get_template_directory() . '/translation');
functions.php:2:+:load_theme_textdomain('fiver', get_template_directory() . '/languages');
functions.php:1:+:load_theme_textdomain('fiver', get_template_directory() . '/translation');
(explanation: string was added in r1 and edited in r2 - trailing part changed)
This question already has answers here:
Using regular expressions to parse HTML: why not?
(18 answers)
Closed 8 years ago.
Can anyone give me the pattern of the regex to get all the local images ONLY. :(
I'm using the code below but it includes the image links.
Regex rgx = new Regex("[^\\/:*?\"<>|]+\\.(?i)(jpg|png|gif|bmp)", RegexOptions.IgnoreCase);
input:
http://dl9.glitter-graphics.net/pub/846/846279rr8zhg26y6.gif
images/strawberries.jpg
output:
846279rr8zhg26y6.gif
strawberries.jpg
I don't want the 846279rr8zhg26y6.gif
If your input strings are bounded somehow (e.g. inside ""s or at the start of the input string) then things are easier, and if the input has a semantic context of being a (relative or absolute) URL, and you only want relative URLs, then easier still.
I would however note that the extension part should probably be jpe?g rather than just jpg and I do wish people would never ever use a bmp on a webpage!