Trying to use an EasyPattern

A discussion of how to use EasyPatterns, EasyPattern Helper and using the EasyPattern library.

Moderator: DataMystic Support

Post Reply

Trying to use an EasyPattern

Post by BHeckle » Mon May 31, 2004 3:48 pm

I am trying to do a replacement using easypatterns for part of my evaulation.

static int
struct descr *retval;

transformed into

static int function_name(struct descr* retval)

my easy pattern for matching fails:
static int[vSpace][(oneOrMore letter or digit)1][leftparen]['retval'][rightparen][vspace][spaces]['struct descr *retval;']

my replace is
static int $1(struct descr* retval)

Please give me a few clues so I can figure out what I am doing wrong.


User avatar
DataMystic Support
Site Admin
Posts: 2328
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia

Post by DataMystic Support » Tue Jun 01, 2004 12:05 pm

Hi B,

Use [cr,lf] instead of [vspace]. vspace matches only a single character.

[spaces] matches a single space, use [1+ spaces]

Debug your pattern from left to right - delete the right hand half and then figure out gradually what you have wrong.

Simon Carter, - Insulin dose calculator for Type 1 diabetes - 250,000 free software downloads - send huge email attachments

Post Reply