Regular Expressions and Dividing Strings

  • Thread starter James Colannino
  • Start date
J

James Colannino

Hey everyone, I have a file containing the following type of data (only
an example):

root:root

What I want to do is take this line and divide it into two separate
strings (the ':' character would divide the two strings, so the result
of the example above would be "root" and "root.") The names will vary
in length (this refers to username/group ownerships.) I'm probably
missing something extremely basic. I found the module re to do the
regular expression matching I need, but I'm not quite sure how I can
actually split this line up into two separate variables.

Thanks in advance :)

James

--
My blog: http://www.crazydrclaw.com/
My homepage: http://james.colannino.org/

"A well regulated militia being necessary to the security of a free
state, THE RIGHT of the people to keep and bear arms SHALL NOT BE
INFRINGED." --United States Constitution, Second Ammendment
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top