# ANSICode Regexp?

**URL:** <https://www.ruby-forum.com/t/ansicode-regexp/146656>\
**Category:** Ruby\
**Created:** [August 23, 2008, 8:13pm UTC](https://www.ruby-forum.com/t/ansicode-regexp/146656 "2008-08-23T20:13:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tcsnide](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@tcsnide](https://www.ruby-forum.com/u/tcsnide)\
**Post date:** [August 23, 2008, 8:13pm UTC](https://www.ruby-forum.com/t/ansicode-regexp/146656/1 "2008-08-23T20:13:09Z")

</div>

Can anyone give me a Regexp to match ANSIcodes.

I’ve tried:

/\e[[0-9]\*\w/

And lots of variations there-of.

The problem seems to be that first ‘’ is never in the regexp.

T.

---

<div class="post-metadata">

**Author:** ![tcsnide](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@tcsnide](https://www.ruby-forum.com/u/tcsnide)\
**Post date:** [August 23, 2008, 8:16pm UTC](https://www.ruby-forum.com/t/ansicode-regexp/146656/2 "2008-08-23T20:16:40Z")

</div>

On Aug 23, 2:08 pm, Trans [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Can anyone give me a Regexp to match ANSIcodes.
> 
> I’ve tried:
> 
> /\e[[0-9]\*\w/
> 
> And lots of variations there-of.
> 
> The problem seems to be that first '' is never in the regexp.

Gad. A soon as I post, I figure out my mistake. I’nt that just the way  
of it.

ANSWER:

/\e[[0-9]\*\w/

T.
