Evolutionary machine learning research aims to develop classifier systems that can solve complex and hard tasks. This paper addresses the problem of inferring a regular expression from a given set of strings for automating the task of information extraction. To the best of our knowledge, this paper is the first to propose the extension of accuracy-based classifier system XCS to learn the regular expressions for text extraction. This new system named as XCSREA includes tree-like code fragments to learn regular expressions. The genetic algorithm in action sets uses two-point crossover with uniform mutation and Roulette wheel parent selection method. Seven different datasets, each with three different lengths, are used to compare the performance of the proposed model with standard genetic programming (GP) approach. The experimental results demonstrate that XCSREA outperforms standard GP approach when sufficiently large numbers of classifiers are used.