Notepad++ dynamic "replace with" - replace

I want to replace found result (with regular expression) by a dynamic space count.
This will be found by: (XY\w.*_\d\d )(\w.*)
XY_bbb_11 PT
XY_brtztsd_34 KJH
XY_bghg_44 LOP
Expected result:
XY_bbb_11 PT
XY_brtztsd_34 KJH
XY_bghg_44 LOP
Is it possible in Notepad++?

This can be done using Elastic TabStops plugin.
Run plugin Manager and install Elastic Tabstops
Go to Plugins > Elastic Tabstops and tick Enable
tick Convert spaces to Elastic Tabs
Screenshot (before):
Screenshot (after):

Related

Regex search causes VS-Code to crash on macbook

I'm trying to search for a RegEx expression using VS-Code's built-in search option.
Here is the regex: (?:((\s|\w+|\d+|\]|\))+)(?<!(\bReact\b))(?<dot>\.(?!\.))+)
As soon as I enter this expression, VS-Code crashes on my macbook.
Is there any way to prevent this?
You have (?<dot>\.(?!\.))+) a named capturing group in your regex. I don't believe that is supported in vscode search across files.
In any case, your original regex froze vscode on my Windows machine, but when I removed the named capturing group, the regex worked fine in BOTH the find in a file widget and searching across files. So this did not freeze vscode for me:
(?:((\s|\w+|\d+|\]|\))+)(?<!(\bReact\b))(\.(?!\.))+)
I suggest you replace the named capturing group with just a simple capturing group.

Lucene regex v4

I am trying to query on Kibana version 7.9.1 for a uuidv4. I disabled the KQL an now it looks like it is using lucene.
Example of a uuid v4:
2334e133-37a6-4039-8acd-b0a561b961b2
Now if I input :
/[0-9a-fA-F]{8}/
in the search bar I get hits, but as soon as I try to escape the hyphen like
/[0-9a-fA-F]{8}\-/
nothing shows up. I would like to use the full regular expression:
[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}
But I can't because of the hyphens.
Is there any other way to escape that pesky hyphen?
I am using elastic search 7.9.1 by the way
I'm not sure why that regex above won't work for you, but this was the best I could come up with given the context: ^[0-9a-fA-F]{8}[^\s\d\w!##$%^&*()_+=\\\][{}|';:"\/.,<>?][0-9a-fA-F]{4}[^\s\d\w!##$%^&*()_+=\\\][{}|';:"\/.,<>?][0-9a-fA-F]{4}[^\s\d\w!##$%^&*()_+=\\\][{}|';:"\/.,<>?][0-9a-fA-F]{4}[^\s\d\w!##$%^&*()_+=\\\][{}|';:"\/.,<>?][0-9a-fA-F]{12}$
It basically is just replacing your "-" with a character not in range "[^...]" that I filled with almost everything except - and added a start character "^" and end character "$"
Again, not sure if lucene is just not using certain parts of regex, but try not escaping the -'s I know some programs will automatically escape symbols for you when using regex.
I ended up using the following regex on lucene in the kibana discover option:
/[0-9a-fA-F]{8}/ AND /[0-9a-fA-F]{4}/ AND /[0-9a-fA-F]{12}/
Not pretty, but it works.

How Can I Create a Regular Expression to Match a String Like This?

I am using Cloud9's IDE and want to use their regex search/replace feature to find all lines of code that look like this:
LINE -(xxx, yyy)
Example:
LINE -(135, 400)
I came up with
/LINE -\(\d{1,3}, \d{1,3}\)\n/g
This works in RegExr but not in Cloud9. I've tried a few variations without any luck. Any ideas?
A few notes about Cloud9 find panel using a Regex:
You don't need to add the / delimiters
The trailing /g is also not needed
You need to enable regex mode in the find box by clicking on the button that says: .*?
I tried the above regex with a dummy file and it worked. Here's the final find query I gave:
LINE -\(\d{1,3}, \d{1,3}\)

Issue Navigation - Substring using regex

Intellij IDEA 12
I wanted to add a new issue navigation link (Settings -> Version Control -> Issue Navigation) for Bitbucket issues (has pattern: https://bitbucket.org/user/repo-name/issue/123).
I want issue ID would be #n (for instance #3, #123 etc).
How can I input issue ID as a regular expression? #\d+ ?
Is it possible to make substring using regex expression because it shouldn't be a hash in the Bitbuckt issue URL?
Try the following:
#(\d+) -- https://bitbucket.org/user/repo-name/issue/$1

Replace exact part of text in a string (fstab) using sed

I'm in the process of migrating some data between 2 servers. The data is held in the same folder structure on each server.
Once the data has been moved I want to update the fstab file on all of the affected Linux machines. I have a bash script that rsyncs the data between the servers and then logs on to each machine in a list and updates the fstab with the new IP address using sed.
sed "s/\(172.16.0.30\)\(.*\)\(${share}\)\(.*\)/172.16.0.35\2\3\4/"
This has worked absolutely fine in the past, however this time I'm migrating a folder which has a name very similar to a few others, let's say $share is 'home':
home
home-old
home-ancient
The problem I'm having is that this regex is picking up all of the shares with the text contained in $share and not just the one I want.
Is there a way to adjust the regex so that it will only replace the IP on the single line that I want? I've looked at the /b variable but can't seem to get it to work, unfortunately regular expressions usually confuse me!
\b is a GNU extension and in this case won't work because it matches a word boundary, and both the space and - are in the group of non-word. It will match all of them. One simple option is to match a space (or end-of-line) character after $share, like:
sed "s/\(172.16.0.30\)\(.*\)\(${share}\)\( \(.*\)\|$\)/172.16.0.35\2\3\4/"