Jump to content

Lookup and replace for columns with more than 4 "#'s"


rpaterick

Recommended Posts

Seeing if this is possible?

 

ex: RON CONLEY APARTMENTS 933

This would be OK to leave the 933 in the record.

 

 

ex: RON CONLEY APARTMENTS 9334

ex: PEP BOYS 1407 4YD

ex: 5806-TGC-280679-WEST CHICAGO

 

I would like FusionPro to take out all of the numbers.

 

Could be any combination of numbers and be anywhere in the cell placed. So basically if there are more than 4 numbers in the record, delete them.

 

Thanks!

Link to comment
Share on other sites

From the description, I think you mean "4 or more," i.e. "more than 3," not "more than 4." Anyway, this should do that:

 

 

return Field("Full Name").replace(/[\<\>\/.]/g," ");

Dan, Thanks for the quick reply(as usual:D).

 

The code abover, how can I incorporate your code with this one? I'm not sure where to insert the addition of taking out the 4 or more numbers.

 

Thanks Dan!

Link to comment
Share on other sites

return Field("Full Name").replace(/[\<\>\/.]/g," ").replace(/\d{4,}/g,'');

 

 

Thanks Dan. I'm thinking of going in a different direction now.:o

 

How can put in multiple formats of PHONE NUMBERS to be taken out?

 

Example of different phone numbers that are formatted in the list.

847 695 3250

847-804-2108

5214626

 

How could I "build" up a code to put in different "#" scenarios(###-###-####, ###-####,(###)-###-####, etc..)

that FusionPro would recognize and replace with nothing?

 

Thanks Dan!!

Link to comment
Share on other sites

How can put in multiple formats of PHONE NUMBERS to be taken out?

 

Example of different phone numbers that are formatted in the list.

847 695 3250

847-804-2108

5214626

 

How could I "build" up a code to put in different "#" scenarios(###-###-####, ###-####,(###)-###-####, etc..)

that FusionPro would recognize and replace with nothing?

Well, I'm not sure I understand the ultimate goal. What else is in the data that shouldn't be replaced? Some specific examples of input and the corresponding desired output would help.

 

That said, you should be able to do something like this:

return Field("YourFieldName").replace(/\(?\b([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})\b/g, '');

I got the regular expression here by Googling for "javascript match phone number":

http://blog.stevenlevithan.com/archives/validate-phone-number#r4-2-v-inline

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...