RegEx for Doctrine Connection String (DSN Format)

I needed to parse a DSN that was in the format used for Doctrine so that I could create my own PDO instances with the same connection strings found in my application.ini file. The regex is as follows:


This will parse a dsn formatted: mysql://db_username:db_password@db_host/db_name.

Came in very handy and hope it can help someone else to take a shortcut!

Wednesday, July 14th, 2010 Doctrine

Leave a Reply

You must be logged in to post a comment.

[ad code=1 align=center]