# Regular expressions are hell

**URL:** <https://forum.kirupa.com/t/regular-expressions-are-hell/161296>\
**Category:** programming\
**Created:** [September 2, 2005, 3:30pm UTC](https://forum.kirupa.com/t/regular-expressions-are-hell/161296 "2005-09-02T15:30:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mlk](https://avatars.discourse-cdn.com/v4/letter/m/e56c9b/32.png) [@mlk](https://forum.kirupa.com/u/mlk)\
**Post date:** [September 2, 2005, 3:30pm UTC](https://forum.kirupa.com/t/regular-expressions-are-hell/161296/1 "2005-09-02T15:30:33Z")

</div>

As with people who’ve experience regex’s for the first time, you know how difficult it is to comprehend.

I’m checking a form and I want to be sure a string is made ONLY out of lowercase letters (no number, spaces etc…)

```php

	if(!preg_match('/[a-z]/',$form['username'])){
		$error = "Use lowercase letters only (a-z)";
	}

       // 'user name' is fine
       // '11111' returns the error
      // 'user name 3' is fine 

```

I want it to return the error if there are spaces or digits/character out of the alphabet

Oh and I tried: **/^[A-z]$/** it returns an error for everything

thanks for you help

mlk
