Can a regex return a match that's not a part of the original string? -


i'm using application requires me provide regex various files. uses matches regex uniquely identify each file , use data store retrieve metadata these files.

there problem application, assumes data used identify each file numeric data. hence, stores results of matches in integers.

i control data store not names of files. since application has bug in it, hoping use encoding scheme convert non-numeric data integer. i'd require regex return that's not part of original string match. possible?

edit: since question unclear. i'm not using programming language. i'm editing configuration file. application written in c++. don't know specific regex implementation using. guess it's not possible then.

the reason asked question sql example allows me return that's not part of table. hoping there might similar regex.

no. regular expression return part(s) of input string match pattern expression. not perform transformations or encodings, nor add stuff elsewhere.

however, languages and/or frameworks support regex-based replacement. in javascript, example, can specify callback function replacement parameter. function called each match:

text = text.replace(/[^0-9]+/g, function (match) {   return match.charcodeat(0); // or whatever encoding want specify }); 

but since never told environment you're working in (programming language, development platform, os) might totally irrelevant you. (hint: next time, tell bit more).

i’d need write code work on matches found regular expression.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -