Re: Regex Doubts

2018-03-30 Thread Iranna Mathapati
Thanks a lot Antoon. On Fri, Mar 30, 2018 at 2:51 PM, Antoon Pardon wrote: > On 30-03-18 08:16, Iranna Mathapati wrote: > > Hi Team, > > > > > > how to achieve fallowing expected output? > > > > str_output= """ > > > > MOD1 memory : 2 valid1790 free > > MOD2 me

Re: Regex Doubts

2018-03-30 Thread Antoon Pardon
On 30-03-18 08:16, Iranna Mathapati wrote: > Hi Team, > > > how to achieve fallowing expected output? > > str_output= """ > > MOD1 memory : 2 valid1790 free > MOD2 memory : 128 valid 128 free > UDP Aware *MEMR*

Re: Regex Doubts

2018-03-30 Thread Cameron Simpson
On 30Mar2018 11:46, Iranna Mathapati wrote: how to achieve fallowing expected output? str_output= """ MOD1 memory : 2 valid1790 free MOD2 memory : 128 valid 128 free UDP Aware *MEMR*: 0 valid 0 free *

Re: Regex Doubts

2018-03-30 Thread Iranna Mathapati
Hi Cameron. str_output= """ MOD1 memory: 2 valid1790 free MOD2 memory: 128 valid 128 free UDP Aware MEMR : 0 valid0 free *MEMR* : 21 valid 491 free Feature XYZ

Regex Doubts

2018-03-29 Thread Iranna Mathapati
Hi Team, how to achieve fallowing expected output? str_output= """ MOD1 memory : 2 valid1790 free MOD2 memory : 128 valid 128 free UDP Aware *MEMR*: 0 valid 0 free *MEMR

Re: regex doubts

2008-07-21 Thread Fredrik Lundh
Perhaps you could explain what you mean by "$ does the right thing". wtf is wrong with you? (I mean, you do know under what circumstances $ matches a newline character when used without modifiers, right? So why do you keep behaving like a reddit commenter?) -- http://mail.python.org/mai

Re: regex doubts

2008-07-21 Thread Fredrik Lundh
John Machin wrote: '\n' is an "other character". so how does a user enter that character? Perhaps you could explain what you mean by "$ does the right thing". wtf is wrong with you? -- http://mail.python.org/mailman/listinfo/python-list

Re: regex doubts

2008-07-20 Thread MRAB
On Jul 19, 10:44 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Jul 20, 6:35 am, MRAB <[EMAIL PROTECTED]> wrote: > > > > > On Jul 19, 9:12 pm, John Machin <[EMAIL PROTECTED]> wrote: > > > > On Jul 20, 5:04 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > > > > Mr SZ wrote: > > > > > I am taking a

Re: regex doubts

2008-07-20 Thread John Machin
On Jul 21, 12:30 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > John Machin wrote: > >> try "[LRM]+$" (an L or an R or an M, one or more times, all the way to > >> the end of the string). > > > Ummm ... with the default flag settings, shouldn't that be \Z instead > > of $ ? > > Why? The OP was rea

Re: regex doubts

2008-07-20 Thread Fredrik Lundh
John Machin wrote: try "[LRM]+$" (an L or an R or an M, one or more times, all the way to the end of the string). Ummm ... with the default flag settings, shouldn't that be \Z instead of $ ? Why? The OP was reading input from a user; whether he gets a trailing newline or not depends on the

Re: regex doubts

2008-07-19 Thread John Machin
On Jul 20, 6:35 am, MRAB <[EMAIL PROTECTED]> wrote: > On Jul 19, 9:12 pm, John Machin <[EMAIL PROTECTED]> wrote: > > > > > On Jul 20, 5:04 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > > > Mr SZ wrote: > > > > I am taking a string as an input from the user and it should only > > > > contain the

Re: regex doubts

2008-07-19 Thread MRAB
On Jul 19, 9:12 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Jul 20, 5:04 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > > Mr SZ wrote: > > > I am taking a string as an input from the user and it should only > > > contain the chars:L , M or R > > > > I tried the folllowing in kodos but they ar

Re: regex doubts

2008-07-19 Thread John Machin
On Jul 20, 5:04 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Mr SZ wrote: > > I am taking a string as an input from the user and it should only > > contain the chars:L , M or R > > > I tried the folllowing in kodos but they are still not perfect: > > > [^A-K,^N-Q,^S-Z,^0-9] > > [L][M][R] > > [LRM

Re: regex doubts

2008-07-19 Thread Fredrik Lundh
Mr SZ wrote: I am taking a string as an input from the user and it should only contain the chars:L , M or R I tried the folllowing in kodos but they are still not perfect: [^A-K,^N-Q,^S-Z,^0-9] [L][M][R] [LRM]?L?[LRM]? etc but they do not exactly meet what I need. > For eg: LRLRLRLRLM is ok

regex doubts

2008-07-19 Thread Mr SZ
Hi, I am taking a string as an input from the user and it should only contain the chars:L , M or R I tried the folllowing in kodos but they are still not perfect: [^A-K,^N-Q,^S-Z,^0-9] [L][M][R] [LRM]?L?[LRM]? etc but they do not exactly meet what I need. For eg: LRLRLRLRLM is ok but LRLRLRNL