I'm a pretty avid user of PyCharm but still having to use Sublime for some things most days and there is always some niggly little things that i find annoying in both. Another one i've just stumbled across not having the ability to regex search navigate File, Class, Symbol etc.
In Sublime i can do cocbas and it will give me templates/cocreate/base.html but in PyCharm it will just give me nothing found as Sublime matches it to the path.
Is there anyway to get regex searching on paths for File navigation?
first of all your cocbas search is not "regex" search.
In intellij, you can search file by pressing ctrl-shift-n, then you can for example:
for file fooo/bar/blah/IAmHere.html do f/b/b/iam you will see the file in the list, in fact you can just typeiah the file would be shown in list too.
Related
This probably isn't a VS Code-specific question but it's my tool of choice.
I have a log file with a lot of lines containing the following:
Company.Environment.Security.RightsBased.Policies.RightsUserAuthorizationPolicy
Those are debug-level log records that clutter the file I'm trying to process. I'm looking to remove the lines with that content.
I've looked into Regex but, unlike removing a blank line where you have the whole content in the search criteria (making find/replace easy), here I need to match from line break to line break on some criteria between the two, I think...
What are your thoughts on how criteria like that would work?
If the criteria is a particular string and you don't want to have to remember regexes, there is a few handy keyboard shortcuts that can help you out. I'm going to assume you're on a Mac.
Cmd-F to open find.
Paste your string.
Opt-Enter to select all of the instances of the string on the page.
Cmd-L to broaden the selection to the entire line of each instance on the page.
Delete/Backspace to remove those lines.
I think you should be able to just search for ^.*CONTENT.*$\n, where the content is the text you showed us. That is, search on the following pattern:
^.*Company\.Environment\.Security\.RightsBased\.Policies\.RightsUserAuthorizationPolicy.*$\n
And then just replace with empty string.
I have already up-voted answer of #james. But.. still I found one more easy and many feature available extension in VS Code. Here it is
It have much easy options to apply filters.
To match specific case mentioned in question. I am attaching screenshot which display how to use for it. I am posting this for others who come here in search for same issue. (Like I came)
I have a project where I've exported an html file to be sanitized in preparation for a language translation. The problem is that the internal links do not have the ".html" extension. I've solved the problem of erasing the long file paths, but appending the remaining file is the problem.
The raw file path is:
href="https://oldsite.com/folder1/folder2/folder3/actualpage
I use this regex to find all instances of 'https://oldsite.com" and subfolders, adapting it to how many subfolders I have:
(https://oldsite.com)+/[a-zA-Z0-9]+/[a-zA-Z0-9]\w+/[a-zA-Z0-9]\w+/[a-zA-Z0-9]\w+/[a-zA-Z0-9]\w+
Leaving me with "href="actualpage"
The ideal result should be:
href="actualpage.html"
I've been researching this for hours and can't figure out how to append ".html" to the page.
I'm even open to an application or script that can automate this process.
Thanks in advance.
After some research and some tutorials, I found a regex that did the trick. After shortening the file paths to one level, I used the following:
In Dreamweaver:
Find:
href="(.*)" title=
Replace:
href="$1.html" title=
I performed a massive Find/Replace and was able to fix 1500 files in minutes. Regex is my jam!
I hope this helps other regex noobs like myself.
This is for all you regex hounds.
I need to filter my search in eclipse when I do a file search.
I am looking for aTracker but this brings back hundreds of results so I want to be able to thin the results out.
First off I would like to remove aTracker.sendException and possibly others.
This is a common problem for me so I'm finally posting for a solution so I don't need to go fetch my waders every time a search like this comes along.
To match all aTracker except aTracker.sendException, you can use a negative lookahead if eclipse supports it:
aTracker(?!\.sendException)
You should check the 'Regular expression' box I think.
I am using Eclipse and I have found instances where I forgot to close my mysql connection. I want to search my entire project of php files and only list the files that don't contain the string:
mysql_close($con);
I can do the search by hitting ctrl-h and bring up a search menu that lets me use regexp to run a search on all the files in my workspace.
I can pull up all pages that do have the string, but I would rather have all the pages that don't have the string, because I will get a much shorter list. Any ideas?
Problem:
^.+ matches only the first line of the source code in dreamweaver. I need it to match each line so that I can wrap each full line in P tags. I have 500 files to do this in.
I know ^ should match the beginning of a line and I also know that multi-line mode must be enabled for it to work on each line and not just at the beginning of the file. I also know dreamweaver uses javascript source code.
Is lack of multi-line mode the problem? Is there any way to turn it on in dreamweaver? I tried using /m at the beginning search to enable multi-line mode, but that didn't work either.
I'm open to any solution for my current problem, even if it involves a different program. However, a fix for dreamweaver is ideal, 2nd place is a way to do this in notepad++, 3rd place is a way do to this in python or something (I only know javascript, you'll have to spell it out exactly in another language).
Thank you,
robert
p.s.
I found I can "select all > right click > selection > indent" to add two spaces to the beginning of each line in dreamweaver. This allows me to find the beginning of each line with / {2,}/. I really don't want to select all > indent on all 500 files, but i'm about to start since I've already spent a few hours bludgeoning dreamweaver.
Don't use Dreamweaver for this - use Notepad++ (since you are familiar with it) at its regular expression support is superior.
If you are comfortable with a more robust scripting language (Python, Ruby, Perl, etc.) then that would be an ever better way to do it.
The way that I might do this in DW would not involve using the find-replace tool's "Regular Expression" option, but instead using just plain old matching on a CrLf.
In the Find portion, since you can't directly enter a CrLf, you'll have to copy one to your clipboard beforehand and paste it in where needed.
In the Replace portion, replace with:
</p>[CrLf]
<p>
Again, be sure to paste in a proper "[CrLf]". This will work on all but the very first and very last lines of your document, so I know this isn't a 100% solution. There are probably better solutions using other tools that someone else can recommend!
Good luck!
-Mike
I had a flash of insight right after posting. (isn't that the way of it?)
Dreamweaver can find the end of each line with \r\n so instead of trying to work forward, i should have just worked backwards.
search: (.+)(\r\n)
replace: <p>$1</p>$2
[\w\W]* matches anything, including a newline. Its greedy, so it fact it matches everything.