Simple Regular Expression
Posted: Thu Mar 11, 2004 5:22 pm
Hi All,
Regular expressions are weird and scary to me, but this seems pretty simple.
I'm trying to chunk through an LDAP domain name. An example string would be:
Now, what I'm trying to do is determine if the above string has a course in it. The course will always be of the form XXXYYY where X = an alphabetic character and Y = an integer. Ideally I'd like only the course name returned, but if it doesn't happen, oh well.
The regular expression I've built so far goes like this:
Then, I do a test on $name and if it's populated, I found a hit.
For some reason, $name[1] will get everything after the match, but $name[0] is empty. So from what I can figure, split() is finding the match, just not putting it in $name correctly. Any thoughts? Thanks.
Regular expressions are weird and scary to me, but this seems pretty simple.
I'm trying to chunk through an LDAP domain name. An example string would be:
Code: Select all
cn=ART999,ou=testobject,o=UniversityThe regular expression I've built so far goes like this:
Code: Select all
$name = split("cn=їa-zA-Z]{3}ї0-9]{3}",$passed_object_name);For some reason, $name[1] will get everything after the match, but $name[0] is empty. So from what I can figure, split() is finding the match, just not putting it in $name correctly. Any thoughts? Thanks.