User Profile

Collapse

Profile Sidebar

Collapse
shantharam
shantharam
Last Activity: Dec 27 '12, 09:08 PM
Joined: Dec 9 '12
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • thanks man. i added all ^,$,+ as u said. it worked.
    See more | Go to post

    Leave a comment:


  • I can actually do this in the following expression:

    re.match('[a-z]{2}|[A-Z]{2}','ab')

    in which the {2} gives the length of the string to be matched. But is there anyway I can make the length of the string to be a variable, like

    c=len(str)
    re.match('[a-z]{c}|[A-Z]{c}','ab')

    where variable 'c' is the length of the string. This doesnt work and 're' is not able to take a variable name inside...
    See more | Go to post

    Leave a comment:


  • Hi Rabbit, thanks for the answer.

    I have actually been trying to use the OR before itself, but then I understood that I am doing wrong when I look for lower case characters itself.

    I thought the expression : em=re.compile('[a-z]')
    will give the correct match for string with lower case only characters, but it is not. It gave the string match for strings like 'asEer'.

    Can you please tell me the way to...
    See more | Go to post

    Leave a comment:


  • shantharam
    started a topic regular expression and case specificality

    regular expression and case specificality

    Can anyone tell me how to write a regular expression that will match strings that either has only lower case or only upper case characters in it. For example, it will match AM, PM, am or parrot but not match Am, aM, Pm or Parrot.
    See more | Go to post
No activity results to display
Show More
Working...