Welcome Guest, Not a member yet? Register   Sign In
how to mask credit card number (using regex?)
#14

[eluser]untermensch[/eluser]
[quote author="Pygon" date="1194049523"]I would think it better to impart different ideas and concepts rather than taking your "just answer the posters question" view so that others could learn and develop their own, better, solutions. Maybe you just want to be right?[/quote]
Clutching at straws now, really. Nobody mentioned right or wrong here. As much as you'd like to think this thread was imparting different ideas and concepts, the poster wanted a simple answer to a simple question, and there's been a fairly poor signal:noise ratio since then.

coolfactor, if you're still here:

You wanted to know how to implement the same regex from Ruby in PHP. To answer that question, you have to do some regex learning, and find that the Ruby regex implementation is more flexible than PCRE in PHP. You have more powerful back-reference operators (eg, $1.length) and the char multiply, therefore allowing the Ruby solution to appear more elegent.

However, I'm not sure PHP gives you anything like "$1.length" directly, which is what's needed to be able to strip off or duplicate a certain number of characters easily in the regex's replace clause. Instead you have to fudge around with substr() or whatever you choose, in order to obtain the same effect - or write a horrendous looking regex to try and perform the same task.


Messages In This Thread
how to mask credit card number (using regex?) - by El Forum - 11-01-2007, 12:24 AM
how to mask credit card number (using regex?) - by El Forum - 11-01-2007, 12:43 AM
how to mask credit card number (using regex?) - by El Forum - 11-01-2007, 12:54 AM
how to mask credit card number (using regex?) - by El Forum - 11-01-2007, 05:46 PM
how to mask credit card number (using regex?) - by El Forum - 11-01-2007, 07:36 PM
how to mask credit card number (using regex?) - by El Forum - 11-02-2007, 08:20 AM
how to mask credit card number (using regex?) - by El Forum - 11-02-2007, 09:42 AM
how to mask credit card number (using regex?) - by El Forum - 11-02-2007, 11:13 AM
how to mask credit card number (using regex?) - by El Forum - 11-02-2007, 12:08 PM
how to mask credit card number (using regex?) - by El Forum - 11-02-2007, 12:13 PM
how to mask credit card number (using regex?) - by El Forum - 11-02-2007, 12:32 PM
how to mask credit card number (using regex?) - by El Forum - 11-02-2007, 12:55 PM
how to mask credit card number (using regex?) - by El Forum - 11-02-2007, 01:25 PM
how to mask credit card number (using regex?) - by El Forum - 11-02-2007, 01:37 PM
how to mask credit card number (using regex?) - by El Forum - 11-02-2007, 01:53 PM
how to mask credit card number (using regex?) - by El Forum - 11-02-2007, 02:35 PM
how to mask credit card number (using regex?) - by El Forum - 11-03-2007, 07:44 AM
how to mask credit card number (using regex?) - by El Forum - 11-03-2007, 12:17 PM
how to mask credit card number (using regex?) - by El Forum - 11-03-2007, 12:44 PM
how to mask credit card number (using regex?) - by El Forum - 11-03-2007, 03:51 PM
how to mask credit card number (using regex?) - by El Forum - 11-03-2007, 06:02 PM
how to mask credit card number (using regex?) - by El Forum - 04-29-2009, 04:09 AM
how to mask credit card number (using regex?) - by El Forum - 04-29-2009, 06:41 AM
how to mask credit card number (using regex?) - by El Forum - 07-23-2009, 11:36 AM
how to mask credit card number (using regex?) - by El Forum - 08-05-2009, 09:37 PM
how to mask credit card number (using regex?) - by El Forum - 06-24-2010, 10:49 AM



Theme © iAndrew 2016 - Forum software by © MyBB