Click here to Skip to main content
15,879,326 members
Home / Discussions / Regular Expressions
   

Regular Expressions

 
GeneralRe: How to insert a space at the beginning of a line in a "for next" code loop (.NET regular expressions) Pin
Richard MacCutchan5-Jul-23 2:21
mveRichard MacCutchan5-Jul-23 2:21 
GeneralRe: How to insert a space at the beginning of a line in a "for next" code loop (.NET regular expressions) Pin
jschell5-Jul-23 5:31
jschell5-Jul-23 5:31 
QuestionNeed help with Regular expression Pin
Member 1601263423-May-23 9:36
Member 1601263423-May-23 9:36 
AnswerRe: Need help with Regular expression Pin
PIEBALDconsult23-May-23 9:39
mvePIEBALDconsult23-May-23 9:39 
AnswerRe: Need help with Regular expression Pin
jschell24-May-23 5:58
jschell24-May-23 5:58 
QuestionRedirection with exclusions RegEx Pin
Member 1598311319-Apr-23 3:07
Member 1598311319-Apr-23 3:07 
QuestionI need help with a complex regex Pin
Member 127465326-Apr-23 3:57
Member 127465326-Apr-23 3:57 
AnswerRe: I need help with a complex regex Pin
Terry R 202312-Apr-23 10:53
Terry R 202312-Apr-23 10:53 
I have tried to decipher what your intent is. I can see you hope to get 9 fields by dividing the original information, but I fail to see where the different parts of the "born" and "death" fields occur.

What I have done thus far is to create a regex which gets the "record" number, the "name", the "birth" info if it exists and the "death" info if it exists. These last 2 fields can be further defined (and divided) if only I knew what your intent was.

Perhaps you can explain what should be in each of the 9 fields (if they exist). Perhaps show a "fully filled" out record as an example, then show what the result should look like.

But here is what I have thus far (this has been formulated on Notepad++):
^(\d+\.\s*)(.+?)(?=(?:b|d)\.)(b\.\s*.+?(?=(?:d\.|$)))?(d\.\s*.+?(?=$))?
To explain it we have:
^(\d+\.\s*) - start of line followed by number(s), a period and possible spaces
(.+?) - gather characters (as few as possible) until...
(?=(?:b|d)\.) - next character should be either a "b" or a "d" followed by a period. The (?: refers to a non-capturing group.
(b\.\s*.+?(?=(?:d\.|$)))? - gather characters until either a "d." follows or end of line.
(d\.\s*.+?(?=$))? - similar to previous line but for the "d." field. This assumes the "d." field will always be last.
Maybe it can give you some more inspiration. At the very least you can see how splitting the problem into smaller chunks may be beneficial. Even if you then have to further divide the "b." and "d." fields in a later step it may still be easier to define them.

Terry
AnswerRe: I need help with a complex regex Pin
Richard MacCutchan12-Apr-23 20:41
mveRichard MacCutchan12-Apr-23 20:41 
GeneralRe: I need help with a complex regex Pin
jschell13-Apr-23 5:29
jschell13-Apr-23 5:29 
GeneralRe: I need help with a complex regex Pin
Richard MacCutchan13-Apr-23 5:52
mveRichard MacCutchan13-Apr-23 5:52 
GeneralRe: I need help with a complex regex Pin
jschell14-Apr-23 11:28
jschell14-Apr-23 11:28 
GeneralRe: I need help with a complex regex Pin
Member 1274653217-Apr-23 20:50
Member 1274653217-Apr-23 20:50 
GeneralRe: I need help with a complex regex Pin
Richard MacCutchan17-Apr-23 22:04
mveRichard MacCutchan17-Apr-23 22:04 
QuestionWhat is the regular expression for this string? Pin
Member 1595912122-Mar-23 11:29
Member 1595912122-Mar-23 11:29 
AnswerRe: What is the regular expression for this string? Pin
Richard MacCutchan22-Mar-23 23:12
mveRichard MacCutchan22-Mar-23 23:12 
GeneralRe: What is the regular expression for this string? Pin
k505423-Mar-23 3:52
mvek505423-Mar-23 3:52 
GeneralRe: What is the regular expression for this string? Pin
Richard MacCutchan23-Mar-23 3:55
mveRichard MacCutchan23-Mar-23 3:55 
AnswerRe: What is the regular expression for this string? Pin
jschell23-Mar-23 6:24
jschell23-Mar-23 6:24 
AnswerRe: Where to start - need to extract...using regular expression Pin
k505415-Mar-23 10:39
mvek505415-Mar-23 10:39 
QuestionRegular expression to return all keys in a Bibtex file Pin
Member 159423565-Mar-23 5:46
Member 159423565-Mar-23 5:46 
AnswerRe: Regular expression to return all keys in a Bibtex file Pin
Richard Deeming5-Mar-23 21:36
mveRichard Deeming5-Mar-23 21:36 
GeneralRe: Regular expression to return all keys in a Bibtex file Pin
Member 159423566-Mar-23 19:48
Member 159423566-Mar-23 19:48 
AnswerRe: Regular expression to return all keys in a Bibtex file Pin
jschell8-Mar-23 6:57
jschell8-Mar-23 6:57 
QuestionRemove all double quotes not directly preceded or directly followed by a semicolon. Pin
Guus20053-Mar-23 3:55
Guus20053-Mar-23 3:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.