# Regex problem with matching dot characters

**URL:** <https://forum.kirupa.com/t/regex-problem-with-matching-dot-characters/284682>\
**Category:** flash\
**Created:** [March 22, 2009, 10:02am UTC](https://forum.kirupa.com/t/regex-problem-with-matching-dot-characters/284682 "2009-03-22T10:02:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Blaeyze](https://avatars.discourse-cdn.com/v4/letter/b/ecccb3/32.png) [@Blaeyze](https://forum.kirupa.com/u/Blaeyze)\
**Post date:** [March 22, 2009, 10:02am UTC](https://forum.kirupa.com/t/regex-problem-with-matching-dot-characters/284682/1 "2009-03-22T10:02:27Z")

</div>

Hello,

I’m having a problem with using regexp to validate form fields, everything is working fine as long as I don’t explicitly try to match a dot(.) character. This fails on both email and the voorletters regex.

I’ve tested both these regexes in RegExr and they are doing what they’re supposed to there.

Can anyone point me towards whats the problem?

```auto
var regex_voorletters:RegExp = /^([A-Z\.])+$/i;
var regex_email:RegExp= /^([\w-\.]+)@((?:[\w]+\.)+)([a-zA-Z]{2,4})$/i

```

```auto
private function regex_test_textfield(tfield:TextInput, regex:RegExp):Boolean {
    trace ("Test called"+tfield.id)
    var test:Boolean= (tfield.text.search(regex)==0);
    if (!test) {
        tfield.setStyle("backgroundColor","0xFF9999"); // red
        trace("Regex failed. Input: "+tfield.text);
        return false;
    } else {
        trace("Regex ok. Input: "+tfield.text);
        tfield.setStyle("backgroundColor","0x99FF99"); //green
        return true;
    };
}

```
