Revision: 69318
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at May 28, 2015 10:49 by bvwatson
Initial Code
#!/usr/bin/perl @words = qw (AS76573 AEDFG103020 A2D104380 S103282 ASD6D6383884 GH63737 AS76573AEDFG103020A2D104380S103282ASD6D6383884GH63737 ); # RETRIEVE DATA AND APPLY MODS $pkey = 0; foreach $orig_word(@words){ $pkey++; $new_word = $orig_word; $new_word =~ s/([a-zA-z][0-9][a-zA-Z]|[^\d])//g; print "\nWord $pkey = $orig_word -> $new_word\n"; } # done --
Initial URL
http://database.ittoolbox.com/groups/technical-functional/sql-l/sql-query-to-remove-texts-and-numbers-5738855
Initial Description
[The original problem was stated as a SQL (SQL Server 2008) problem. This Perl script demonstrates the desired outcome for the problem statement.] PROBLEM STATEMENT: Please help me with SQL Query and requirement is as below: Below is the Data and I have to remove all texts associated with numbers. If incase in between LETTERS if we see number or numbers, those also should be removed, for ex:A2D104380, here A2D should be removed, others only letters. Field_Name AS76573 AEDFG103020 A2D104380 S103282 To add to your point. Yes you are correct but gain if exists number and again followed by any letters then number also should be removed. For ex: ASD6D6383884 Here ASD6D should be removed. GH63737. Here only GH should be removed SOLUTION RESULTS: Word 1 = AS76573 -> 76573 Word 2 = AEDFG103020 -> 103020 Word 3 = A2D104380 -> 104380 Word 4 = S103282 -> 103282 Word 5 = ASD6D6383884 -> 6383884 Word 6 = GH63737 -> 63737 Word 7 = AS76573AEDFG103020A2D104380S103282ASD6D6383884GH63737 -> 76573103020104380103282638388463737
Initial Title
RegEx string substitution
Initial Tags
regex, perl
Initial Language
Perl