Separating words with Regex (Not in specific order)

Emre

Extracting from text For example; the following sentence contains the initial capital letters. How can I separate them?

Text:

A. lorem ipsum dolor sit B . 41dipiscing elit sedC. lorem ipsum dolor sit amet D. 35 Consectetur adipiscing E .Sed do eiusmod tempor

Goal:

A. lorem ipsum dolor sit 
B . 41dipiscing elit sed 
C. lorem ipsum dolor sit amet 
D. 35 Consectetur adipiscing 
E .Sed do eiusmod tempor

What have I done?

^(([a-zA-Z]{1}|[0-9]+)\s*[.,]{1})(.*)$

Result:

https://regex101.com/r/4HB0oD/1

But my Regex code doesn't detect it without first sentence. What is the reason of this?

CAustin

This pattern should do what you're looking for:

[A-Z\d] ?\..+?(?=$|[A-Z\d] ?\.)

https://regex101.com/r/i92QR1/1

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

REGEX: find URL with specific words/pages

分類Dev

Kibana query for sentence (words with specific order) with 4 digit number

分類Dev

Regex for "or" of multiple words in grep

分類Dev

Separating specific MySQL columns from row fetch into another array in php

分類Dev

Specific Regex/Regex Condition

分類Dev

Highlight Words from a Regex Match

分類Dev

Regex Expression for Finding Words Surrounded By {{ }}

分類Dev

Regex pattern counting with repetitive words

分類Dev

Regex to select words with spaces for subsititution

分類Dev

Substituting part of words in Perl regex

分類Dev

.htaccess Do not Redirect Specific Words

分類Dev

Check for specific words that is not exist in document

分類Dev

Renaming images in specific order

分類Dev

Ordering list by a specific order

分類Dev

Change words order function "error" C

分類Dev

Regex for specific domain name

分類Dev

Regex for ending with a specific word

分類Dev

Python Regex for a Specific Word

分類Dev

Arrange tabs in specific order for specific device size

分類Dev

Android Studio and regex search (find more words)

分類Dev

How to partial search for words using regex python

分類Dev

RegEx for matching one to three words after a keyword

分類Dev

What is the regex to match the words containing all the vowels?

分類Dev

Regex JS: Searching between two same words

分類Dev

find words that matches the 3 consecutive vowels Regex

分類Dev

Regex: How to ignore dots in connected words

分類Dev

Regex matching of substrings separated by max N words

分類Dev

Regex Match "words" That Contain Periods perl

分類Dev

Regex to find words that contain hyphen MS Office

Related 関連記事

ホットタグ

アーカイブ