Append a various text after the closing bracket - regex

I have below code, and using IntelliJ ,find and replacement. I want to append .driver to it
Current code:
click(page.username)
click(page.password)
Expected code:
click(page.username,driver)
click(page.password,driver)
Note- after click(, the text has different values.

Open find and replace panel in InteliJ.
Find text )
replace text ,driver)
Replace one by one in case you have other ) characters. Click on exclude to ignore and replace to replace text.

Related

How to lowercase selected text using a Replace RegEx in Notepad++

I'm looking for a way to lowercase selected BACKTICKED text using a regex in Notepad++
Here's an example string:
Select * FROM `Weird_TEXT` WHERE
And the desired output:
Select * FROM `weird_text` WHERE
I can find these strings (including the backticks) using the regex:
(?<=FROM )(.*)(?= WHERE)
`Weird_TEXT`
But I can't figure out how to replace the text as lowercase, I've tried using the following:
\1\L\2\L
\1\L\2\L\3
EDIT:
When I click Find Next in Notepad++, the backticks around the word Weird_TEXT are included in the selection. Could this be why the RegEx isn't working?
Just put this in the replace box:
\L$1

Extracting text between quotation marks in notepad++

My file contains above 2000 abstracts containing above 18000 sentences, starting with tag and ending in tag . I want to find the information by use of notepad++,
A view of my file is as below:
<abstract>
<sentence>Activationofthe<conslex="CD28_surface_receptor"sem="G#protein_family_or_group"><conslex="CD28"sem="G#protein_molecule">CD28</cons>surfacereceptor</cons>providesamajorcostimulatorysignalfor<conslex="T_cell_activation"sem="G#other_name">Tcellactivation</cons>resultinginenhancedproductionof<conslex="interleukin-2"sem="G#protein_molecule">interleukin-2</cons>(<conslex="IL-2"sem="G#protein_molecule">IL-2</cons>)and<conslex="cell_proliferation"sem="G#other_name">cellproliferation</cons>.</sentence>
<sentence>In<conslex="primary_T_lymphocyte"sem="G#cell_type">primaryTlymphocytes</cons>weshowthat<conslex="CD28"sem="G#protein_molecule">CD28</cons>ligationleadstotherapidintracellularformationof<conslex="reactive_oxygen_intermediate"sem="G#inorganic">reactiveoxygenintermediates</cons>(<conslex="ROI"sem="G#inorganic">ROIs</cons>)whicharerequiredfor<conslex="CD28-mediated_activation"sem="G#other_name"><conslex="CD28"sem="G#protein_molecule">CD28</cons>-mediatedactivation</cons>ofthe<conslex="NF-kappa_B"sem="G#protein_molecule">NF-kappaB</cons>/<conslex="CD28-responsive_complex"sem="G#protein_complex"><conslex="CD28"sem="G#protein_molecule">CD28</cons>-responsivecomplex</cons>and<conslex="IL-2_expression"sem="G#other_name"><conslex="IL-2"sem="G#protein_molecule">IL-2</cons>expression</cons>.</sentence>
<sentence>Delineationofthe<conslex="CD28_signaling_cascade"sem="G#other_name"><conslex="CD28"sem="G#protein_molecule">CD28</cons>signalingcascade</cons>wasfoundtoinvolve<conslex="protein_tyrosine_kinase_activity"sem="G#other_name"><conslex="protein_tyrosine_kinase"sem="G#protein_family_or_group">proteintyrosinekinase</cons>activity</cons>,followedbytheactivationof<conslex="phospholipase_A2"sem="G#protein_molecule">phospholipaseA2</cons>and<conslex="5-lipoxygenase"sem="G#protein_molecule">5-lipoxygenase</cons>.</sentence>
<sentence>Ourdatasuggestthat<conslex="lipoxygenase_metabolite"sem="G#protein_family_or_group"><conslex="lipoxygenase"sem="G#protein_molecule">lipoxygenase</cons>metabolites</cons>activate<conslex="ROI_formation"sem="G#other_name"><conslex="ROI"sem="G#inorganic">ROI</cons>formation</cons>whichtheninduce<conslex="IL-2"sem="G#protein_molecule">IL-2</cons>expressionvia<conslex="NF-kappa_B_activation"sem="G#other_name"><conslex="NF-kappa_B"sem="G#protein_molecule">NF-kappaB</cons>activation</cons>.</sentence>
<sentence>Thesefindingsshouldbeusefulfor<conslex="therapeutic_strategies"sem="G#other_name">therapeuticstrategies</cons>andthedevelopmentof<conslex="immunosuppressants"sem="G#other_name">immunosuppressants</cons>targetingthe<conslex="CD28_costimulatory_pathway"sem="G#other_name"><conslex="CD28"sem="G#protein_molecule">CD28</cons>costimulatorypathway</cons>.</sentence>
</abstract>
I want to extract the text between quotation marks e.g. my desired output is like this
"CD28_surface_receptor" "G#protein_family_or_group" "CD28" "G#protein_molecule"
"primary_T_lymphocyte" "G#cell_type"
i hope there will be a simpler way of doing so with notepad++ through use of regx. task may become easy if there is a way to extract the text on the basis of color in notepad++
Check the below
"\w+"|"G#\w+"
or operator | works in lateste notepad ++ only

How to perform negative search (or replace) in common text editors

Is there any way I can replace all the words/lines which don't match in my search query in text editors like notepad++ or sublime text.
For example I have a document having few url links in it. Can I do something which leaves only url links in my document. If I have to remove url links, I can search them using regex and replace them with an empty string. But can I do the same thing but for the content which doesn't match regex.
Example:
this is line which I want to remove and can also have special characters in it link % $ [] (0) and here is url: https://google.com one more line with some random garbagee and https://www.example.com
For above text, output should be:
https://google.com
https://www.example.com
In Sublime Text, you can search, hit "Find All", then copy and paste all the matches at once into a new document. This isn't exactly "negative search", but it does accomplish your goal.
With Notepad++ you can do it in two passes. The first pass isolates the wanted text. The second pass removes the unwanted pieces.
Firstly do a regular expression search for \b(https://[^\s]+)(\s|$) and replace with \r\n\1\r\n. This is a very crude and easy to fool URL detector, but it works on the examples you give. The search string looks for "https://" preceded by a word boundary (ie \b). That is followed by some non-whitespace characters that are considered to be part of the wanted text. The last part of the search text looks for either a whitespace character or the end of line. The wanted part is retained in a capture for the replace text.
Second do a regular search for ^https:// using the "Mark" tab in the find window. Select "Bookmark lines" then click on "Mark all". (You might like to click on "Clear all marks" before clicking on "Mark all".) Finally use menu => Search => Bookmark => Remove unmarked lines.
(Checked in Notepad++ version 6.6.9)
In SynWrite app:
call dialog "Search/ Extract strings"
enter Regex for URL, do "Find"
now press button to copy found URLs to new tab

Regular expression to replace two blank lines with one blank line

I'd like to use Xcode's find and replace by regex to remove unnecessary blank lines in my code. In other words I want to replace this:
NSString *helloString = #"Hello";
helloString = [helloString stringByAppendingString:#" World"];
With this:
NSString *helloString = #"Hello";
helloString = [helloString stringByAppendingString:#" World"];
I tried typing control+q return control+q return in the search box (inspired by this answer but it didn't match anything.
What should the regex be?
Copy 2 of the empty lines from your source, press APPLE-OPTION-F to display the searchbar and paste the two lines into the first field.
Then go the second field and enter OPTION-RETURN
Then hit the replace button on the right
Be aware that this matches only lines with the same indendation/spaces/tabs as your copied line. If you need something more flexible better use a texteditor supporting regexen.
As possible regex could be something like "\n.*\n"
I don't know regex very well. I'd just use a simple find and replace of literal strings. Select a blank line by putting your cursor on the last character of a line and pressing shift right-arrow to select the line break. Then bring up a replace dialog and paste 2 blank lines into the find field, and 1 blank line into the replace field.
Xcode doesn't support regex matches across multiple lines, per this mailing-list posting from Apple employee #8 Chris Espinoza.
You could do a two-step process:
Do a regex search like this, to remove whitespace characters from otherwise empty lines:
Find: ^\s+$
Replace: leave blank.
Do a textual (non-regex) search like this, to replace two empty lines with one:
Select two blank lines and go to Edit > Find > Use Selection For Find (Command-E)
Select a single blank line and go to Edit > Find > Use Selection For Replace (Command-Shift-E)
For such tasks and other formatting perhaps you'd like to check uncrustifyX, it's quite easy to use and extensive.

How to group lines of text using Notepad++

I find Notepad++ regex to be very different from regex in Microsoft Word. I was wondering how I can group several lines of text using Notepad++. I have a text file with 100+ URLs. They are written one URL address per line. I would like to group all of them by tens by removing the carriage returns from every first to 9th line, but retaining the carriage return on every 10th line and adding another carriage return thereafter. For example:
I want this:
http://website1.com
http://website2.com
http://website3.com
http://website4.com
http://website5.com
http://website6.com
http://website7.com
http://website8.com
http://website9.com
http://website10.com
http://website11.com
http://website12.com
http://website13.com
http://website14.com
http://website15.com
http://website16.com
http://website17.com
http://website18.com
http://website19.com
http://website20.com
http://website21.com
http://website22.com
http://website23.com
http://website24.com
http://website25.com
http://website26.com
http://website27.com
http://website28.com
http://website29.com
http://website30.com
to look like:
http://website1.comhttp://website2.comhttp://website3.comhttp://website4.comhttp://website5.comhttp://website6.comhttp://website7.comhttp://website8.comhttp://website9.comhttp://website10.com
http://website11.comhttp://website12.comhttp://website13.comhttp://website14.comhttp://website15.comhttp://website16.comhttp://website17.comhttp://website18.comhttp://website19.comhttp://website20.com
http://website21.comhttp://website22.comhttp://website23.comhttp://website24.comhttp://website25.comhttp://website26.comhttp://website27.comhttp://website28.comhttp://website29.comhttp://website30.com
Any help would be appreciated!
Ok, I have found a way:
There is a such possibility, but only with 6 entries in a row (longest regex is not parsed by the Notepad++).
1)So, open the file and remove from it all newlines characters, so the text will be a long-long line.
2)Open replace dialog, insert in the "Find what" field the next :
(http://[^\:]*\.comhttp://[^\:]*\.comhttp://[^\:]*\.comhttp://[^\:]*\.comhttp://[^\:]*\.comhttp://[^\:]*\.com)
and in the "Replace With" the next:
\1\r\n
Put the cursor at the first position in the text and press "Replace all"
So, the regex contains this (http://[^\:]*\.com){6} (the regex is repeated 6 times). If you work with Unix and you need unix-type new line style, replace this : \1\r\n with this \1\n