﻿id	summary	reporter	owner	description	type	status	milestone	component	version	severity	resolution	keywords	cc
588	StringRegExpReplaceCallback	RobSaunders	Valik	"I know that it's annoying when people compare AutoIt to other languages and say ""Hey they have this function, you should too!"" but at the risk of being hypocritical here, I really think this function would be handy.
PHP has a function called [http://ca3.php.net/manual/en/function.preg-replace-callback.php preg_replace_callback] ([http://ca3.php.net/manual/en/function.preg-replace.php preg_replace] is basically our StringRegExpReplace). Instead of passing a static string as the 'replace' parameter, you provide a callback function. At the very simplest of possibilities, this could allow for code like this:
{{{
$text = ""Hello, my name is Rob and I'm here today to tell you all about sponges! These wonderful things have made a huge impact on life in modern times""
$text = StringRegExpReplaceCallback($text, '(t[^ ]+)', '_Capital')

Func _Capital($matches)
	Return StringUpper($matches[0])
EndFunc
}}}

The callback function is passed an array with each group as an element (so if my pattern had been something like {{{'(t[^ ]+) ([^ ]+)'}}} then $matches would have two elements), and the function returns what the replacement string should be. In the case of my example, it simply capitalizes every word that starts with T.
I wouldn't be asking for this if I thought it was possible with a UDF, but after looking at it for a while I simply can't figure out a fool proof way to do it, so that's why I made this ticket.

Thanks for reading."	Feature Request	closed		AutoIt		None	Rejected	string regular expression replace callback	admin@…
