Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: TRegGex


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 1 - Last Post: Feb 15, 2018 2:02 PM Last Post By: Antonio Estevez Threads: [ Previous | Next ]
CARRE DAVID

Posts: 1
Registered: 1/6/18
TRegGex  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 15, 2018 1:45 PM
Hi
If somone have any idea ??
In fact even just using the given exemple in the official documentation of TreGex, I have a compilation error !!
[
bcc32 Erreur] Unit4.cpp(17): E2293 ) attendu
[bcc32 Erreur] Unit4.h(21): E2293 ) attendu


#ifndef Unit4H
#define Unit4H
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
//---------------------------------------------------------------------------
class TForm4 : public TForm
{
__published: // Composants gérés par l'EDI
TEdit *Edit1;
TEdit *Edit2;
TButton *Button1;
void __fastcall Button1Click(TObject *Sender);
private: // Déclarations utilisateur
public: // Déclarations utilisateur
__fastcall TForm4(TComponent* Owner);
TForm4::ReplaceCC(const TMatch &Match); //********* HERE there is an error !!!

};
//---------------------------------------------------------------------------
extern PACKAGE TForm4 *Form4;
//---------------------------------------------------------------------------
#endif

#include <vcl.h>
#pragma hdrstop

#include "Unit4.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm4 *Form4;
//---------------------------------------------------------------------------
__fastcall TForm4::TForm4(TComponent* Owner)
: TForm(Owner)
{
}

System::UnicodeString __fastcall TForm4::ReplaceCC(const TMatch &Match) //********* and HERE there is an error !!!
{
i = i + 1;
return IntToStr(i);
}


//---------------------------------------------------------------------------
void __fastcall TForm4::Button1Click(TObject *Sender)
{
const System::UnicodeString input = Edit1->Text;
TRegEx *regex = new TRegEx("cc");
TMatchEvaluator myEval = &ReplaceCC;
i = 0;
Edit2->Text = regex->Replace(input, myEval);

}
//--------------------------------------------------------------Thanks to help me



Edited by: CARRE DAVID on Feb 15, 2018 1:45 PM

Edited by: CARRE DAVID on Feb 15, 2018 1:46 PM
Antonio Estevez

Posts: 665
Registered: 4/12/00
Re: TRegGex [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 15, 2018 2:02 PM   in response to: CARRE DAVID in response to: CARRE DAVID
El 15/02/2018 a las 22:47, CARRE DAVID escribió:
Hi
If somone have any idea ??
In fact even just using the given exemple in the official documentation of TreGex, I have a compilation error !!
[
bcc32 Erreur] Unit4.cpp(17): E2293 ) attendu
[bcc32 Erreur] Unit4.h(21): E2293 ) attendu


#ifndef Unit4H
#define Unit4H
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>


Add the following line:
#include <System.RegularExpressions.hpp>


//---------------------------------------------------------------------------
class TForm4 : public TForm
{
__published: // Composants gérés par l'EDI
TEdit *Edit1;
TEdit *Edit2;
TButton *Button1;
void __fastcall Button1Click(TObject *Sender);
private: // Déclarations utilisateur
public: // Déclarations utilisateur
__fastcall TForm4(TComponent* Owner);

TForm4::ReplaceCC(const TMatch &Match); //********* HERE there is an error !!!

Replace that line with:
     System::UnicodeString __fastcall ReplaceCC(const TMatch &Match);
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02