My word file contain some data which are following
#: app_s/accounting/admin.py:819
/Ingles/ "Detail Registers"
/Holandes/ "Registros detallados"
#: app_s/accounting/admin.py:831
/Ingles/ "Grouped per person"
/Holandes/ "Agrupado por persona"
But I want to delete the portion of line which starting with #: app_s/ from every line. my output should be like that:
/Ingles/ "Detail Registers"
/Holandes/ "Registros detallados"
/Ingles/ "Grouped per person"
/Holandes/ "Agrupado por persona"
You can do this with a wildcard Find/Replace, where:
Find = #: app[!^11^13]#[^11^13]
Replace = nothing
Related
I am trying to extract whatever is between two strings. The first string is a known string, the second string could be from a list of strings.
For example,
We have the start string and the end strings. We want to get the text between these.
start = "start"
end = ["then", "stop", "other"]
Criteria
test = "start a task then do something else"
result = "a task"
test = "start a task stop doing something else"
result = "a task"
test = "start a task then stop"
result = "a task"
test = "start a task"
result = "a task"
I have looked at using a regex, and I got one which works for between two strings, I just cannot create one which words with a option of strings:
(?<=start\s).*(?=\sthen)
I have tried using this:
(?<=start\s).*(?=\sthen|\sstop|\sother)
but this will include 'then, stop or other' in the match like so:
"start a task then stop" will return "a task then"
I have also tried to do a 'match any character except the end list" in the capture group like so: (?<=start\s)((?!then|stop|other).*)(?=\sthen|\sstop|\sother) but this has the same effect as the one above.
I am using swift, so I am also wondering whether this can be achieved by finding the substring between two strings.
Thanks for any help!
You may use
(?<=start\s).*?(?=\s+(?:then|stop|other)|$)
See the regex demo. To search for whole words, add \b word boundary in proper places:
(?<=\bstart\s).*?(?=\s+(?:then|stop|other)\b|$)
See another regex demo
Details
(?<=start\s) - a positive lookbehind that matches a location immediately preceded with start string and a whitespace
.*? - any 0+ chars other than line break chars, as few as possible
(?=\s+(?:then|stop|other)|$) - a position in the string that is immediately followed with
\s+ - 1+ whitespaces
(?:then|stop|other) - one of the words
|$ - or end of string.
I have to validate last name for example if my last name it's a compound and contains "DE", "DEL", "DE LA" what is the best way to identify that and eliminate
For example if my last name is "DEL ROSAL", I want to identify "DEL" and then remove but if my last name it is "DELGADO" what happens with "DEL"
I read that I can use contains if it is possible?
let apellido_paterno = TxtApellidoP.text!
if apellido_paterno.contains("DEL"){
// Expected output if my last name its "DEL ROSAL": ROSAL
// What happens if my last name its: "DELGADO" ???
}
I managed to get the result you wanted by using .contains() and evaluating a String assigned as "compounder".
For example if the compound last name is "DE LA FUENTE", the compounder would be "DE LA" (as you explained above).
I also created an array and a for loop in order to make it easier to check
let apellidoPaternoInput = "DE LA FUENTE"
var apellidoPaternoOutput = String()
let compounderArray = ["DEL", "DE LA", "DE"]
for compounder in compounderArray {
if apellidoPaternoInput.contains(compounder){
apellidoPaternoOutput = apellidoPaternoInput.components(separatedBy: " ").last ?? ""
//last component of an array containing all the words from the input last name
}
}
print(apellidoPaternoOutput)
Note that a new variable, apellidoPaternoOutput is created, and it corresponds to the last element of an array generated when the input last name (apellidoPaternoInput) is separated by spaces.
By doing this (using the last element of the array separated by spaces) you make sure that last names such as "DELGADO" remain intact.
In this case, the output would be "FUENTE".
Hope this helps.
Given the example in the RUTA Guide:
DECLARE Sentence;
PERIOD #{-> MARK(Sentence)} PERIOD;
I would like to include the first PERIOD in the sentence annotation, is that possible ?
Do you want the first period "." in the sentence annotation? You can do that with the following script.
DECLARE Sentence;
(PERIOD #){-> MARK(Sentence)} PERIOD;
or
DECLARE Sentence;
(PERIOD #){-> Sentence} PERIOD;
Using input: "my first sentence. And my second sentence."
You will get ". And my second sentence" marked as sentence.
Is that what you try to achieve? I don't think so ;-) I think you want real sentences with the dot at the end of the sentence?
You can do that for example with:
DECLARE Sentence;
((# PERIOD){-> Sentence })*;
You will get:
"my first sentence."
and " And my second sentence." marked as sentence.
I am designing my pdf with a table, so pdf cells recieve a phrase and not a paragraph.
I have this phrase:
Phrase subject = new Phrase( "Subject: " + NEWLINE + investigation.Title);
and I want the word "subject" will be highlighted with a diffrent font, how do I change the font for a single word in a phrase
I would like to do it somehing like that:
Chunk chunk = new Chunk("Conclusions", titleFont);
Chapter chapter = new Chapter(new Paragraph(chunk), 1);
chapter.NumberDepth = (0);
chapter.Add(new Paragraph(investigation.InvestigationResult, textFont));
doc.Add(chapter);
but in a phrase
Split your text and create a chunk for each part (or at least a chunk for the part that varies). You can set the font for each chunk individually and then add all chunks to a phrase.
I have a file with hundreds of these kind of statements:
If Description = "Approach light" Then Obstakelcode = "AL"
If Description = "Common mast" Then Obstakelcode = "CoM"
etc.
With a Notepad++ macro I tried to 'mirror' these statements in:
If Obstakelcode = "AL" Then Description = "Approach light"
If Obstakelcode = "CoM" Then Description = "Common mast"
etc.
However, I failed. Can anybody tell me if this can be done easily with Notepad++?
On the Notepad++ Find/Replace screen, with Regular expression selected, please type
Find what
If\s(Description\s+=\s+\"[^\"]+\")\s+Then\s(Obstakelcode\s=\s\"[^\"]+\")
Replace with
If \2 Then \1
The expression between If and Then is captured as group \1 and the expression between Then up to the closing " is captured as \2. The Replace command mirrors it according to your requirement.