Merging broken lines [closed] - regex

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 14 days ago.
This post was edited and submitted for review 14 days ago.
Improve this question
In a text with many lines in notepad++, some lines are unintentionally broken into the next line without an end point. I want to merge lines that are more than 10 characters long that do not end with a dot(.) with of regex. Also put a space between merged lines.
For example, the following text:
tttttttttt
aaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbb.
ccccccccccccccccc
dddddddddddddddddd.
Convert to:
tttttttttt
aaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbb.
ccccccccccccccccc dddddddddddddddddd.
I also tried the following regex code but it didn't work:
[^\.]\n

Related

How to "extract" string before "-" but if the string itself can contain a "-"? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have list of packages like this (it's bigger than this):
accounts-qml-module-0.7-3
accountsservice-0.6.55-3
alsa-firmware-1.2.1-2
alsa-oss-1.1.8-3
alsa-plugins-1:1.2.2-2
alsa-utils-1.2.3-2
augeas-1.12.0-2
baloo-5.74.0-1
baloo-widgets-20.08.1-1
binutils-2.35-2
breath2-icon-themes-1.0.10-2
breath2-wallpaper-1.0.10-2
bridge-utils-1.7-1
brltty-6.0-11
cfitsio-1:3.49-1
clucene-2.3.3.4-11
colord-sane-1.4.4+9+g1ce26da-2
confuse-3.3-1
containerd-1.4.1-1
convertlit-1.8-10
cpio-2.13-2
cracklib-2.9.7-2
cronie-1.5.5-1
cups-2.3.3-3
cups-filters-1.28.3-1
cups-pdf-3.0.1-5
cups-pk-helper-0.2.6-4
debootstrap-1.0.123-1
dhcpcd-9.2.0-1
diffutils-3.7-3
ding-libs-0.6.1-3
discount-2.2.7-1
djvulibre-3.5.27-6
dkms-2.8.3-1.1
docbook-xml-4.5-9
docbook-xsl-1.79.2-7
I'd like to have:
accounts-qml-module
accountsservice
alsa-firmware
alsa-oss
alsa-plugins
alsa-utils
augeas
baloo
baloo-widgets
but I don't really know how to do since there are some packets that have a "-" dash inside and I'm very confused about how could I achieve this avoiding to do it manually...
Is there a bash "trick" to do it?
try this regex :
^.+?(?=-[\d.\-:+]+)
demo

Why lone line in fortran code in one part is highlighted and become like comment? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I'm trying to write a fortran code for 1 phase flow in porous media.
In discretized equations and other long line I have a below problem as you see in the picture.
After that highlighted phrase my code become like comment.
Can anyone help me?
According to this:
In its current state, the syntax highlighting for fixed-form Fortran in the extension only supports a line length of 72 characters. Anything after column 72 appears as comments (green) in the source code, which also affects the appearance of the following lines (when a closing parenthesis is in this green region for example)
You can change it on fortran_fixed-form.tmLanguage.json file or on the VS code settings.

Regex (Bigquery) get specific values from STRING [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I have the STRING - TX1234XT batch 44, 1111ABCDEF
TX1234XT (Can be different length)
batch 44 (number can be different length)
ABCDEF (can be a different length, but always have 1111 at the start)
What I need is to generate two columns:
BatchNumber Name
44 1111ABCDEF
1 1111SAMPLE
999 1111Example
Starting point:
First is done:
REGEXP_EXTRACT(reference, r'1111[a-zA-Z0-9_.+-]+') AS Name
Second
- REGEXP_REPLACE(REGEXP_EXTRACT(reference, r'batch [0-9_.+-]+'),r'batch ','') AS BatchNumber
SORTED ^_^
I don't really know Google Big Query, but if you want to extract the batch number and the value at the end, you could go with this regular expression:
/^.*?batch\s*(\d+),\s*(1111.+)$/
(\d+) will capture your batch id.
(1111.+) will capture the value starting with 1111.
Example here: https://regex101.com/r/SJXmIV/2

Replace the words "can't, don't" by "can not, do not" using python [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
This post was edited and submitted for review 1 year ago and failed to reopen the post:
Original close reason(s) were not resolved
Improve this question
I need to replace words like "{can't, don't, won't }" by "{can not, do not, would not}" using python
The problem is:
"can't" can be detected by checking suffix "n't", so we can replace "n't" by "not"
But how can we transform "ca" to "can" as when we split "can't" it should be transformed to "can not"?
Since the rules of English are large and sometimes inconsistent, your best bet is probably just to set up full word maps rather than trying to figure out on the fly which letters are represented by the apostrophe.
In other words, a dictionary with values like:
can't -> can not
don't -> do not
won't -> will not
:
oughtn't -> ought not

Recognizing patterns given a set of sentences [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have a text file with lots of sentences. These sentences can occur in patterns. How do I recognize these patterns?
For example:
i woke up in the morning
i went to school
i played football
i came back home
i woke up in the morning
i went to school
i played basketball
At this point I want the program to say that "I played football" should have appeared.
This task seems to little bit complicate,but you can try this simple code for understanding or if finds it useful you can further implement it::
//the sentences/input input String
String sampleString1="xyz";
String[] sampleString2=sampleString1.split(".");
for(int i=1;i<=sampleString2.length;i++){
//The pattern which you can specify to match with the sentence
if(sampleString2[i].substring(0, 14).equals(sampleString2[0].substring(0,16))){
//code to execute the matched sentence.
System.out.println("Sentence matching with pattern ::" + sampleString2[i]);
}
}
If the pattern to be matched is the first line of the sequence ,then try this code.