8 Replies Latest reply on Jan 9, 2017 8:15 AM by andrewa52355798

    Formatting phone numbers with GREP

    andrewa52355798

      Hi!

       

      I have an InDesign document with loads of international phone numbers in it, of various lengths, with various formats and spacings...some are 1 234 56789; some are (12) 34-56789; some are 1234 56 and so on. The only thing they have in common is they all come after the word 'Tel: ' and before the word 'Fax:'. I need to format them so they are in the format 123 456 7891 without any dashes or dots.

       

      Is there a way of doing this using positive/negative look behind? I'm a bit of a GREP novice, and nothing I have tried seems to work consistently across all the number formats.

       

      All help greatly appreciated, thanks!

       

      Andrew

        • 1. Re: Formatting phone numbers with GREP
          Eugene Tyson Adobe Community Professional & MVP

          Can you please give a copy and paste of exactly what it is  in terms of content with some real examples.

           

          Please feel free to substitute the text with lorem ipsum

          • 2. Re: Formatting phone numbers with GREP
            Michael Witherell Adobe Community Professional

            Most could be converted this way:

             

            In the Find/Change dialog box (cmd/ctrl+f), there are some pre-made GREP queries.

             

            One is named Phone Number Conversion (dot format)

             

            If you choose this one, you will also have to modify the Change To field.

             

            Instead of $1.$2.$3, you will have to replace the dots with spacebar spaces instead (to get the look you requested).

             

            You should be able to click Change All and have most of them converted correctly. For numbers with country codes in front of them, you would have to add on to this GREP to account for the fourth group of numbers that might exist.

            • 3. Re: Formatting phone numbers with GREP
              Obi-wan Kenobi Adobe Community Professional

              Hi,

               

              After opening ID and realizing, as in France, Tel numbers have 10 numbers, I would try:

               

              Find:  (?:Tel|Fax):\h\K[\h()._-]*(\d)[\h()._-]*(\d)[\h()._-]*(\d)[\h()._-]*(\d)[\h()._-]*(\d)[\h ()._-]*(\d)[\h()._-]*(\d)[\h()._-]*(\d)[\h()._-]*(\d)[\h()._-]*(?=\d)

              Replace by:  $1$2$3~s$4$5$6~s$7$8$9

               

              That treats all separators between numbers:

               

              (

              )

              -

              _

              .

               

              and gives:

               

              000 000 0000

               

              (^/)

              • 4. Re: Formatting phone numbers with GREP
                andrewa52355798 Level 1

                Here's some sample text from it. All  phone numbers need to be converted into a ddd dddd dddd format (or shorter if the number is shorter than that)

                 

                 

                A.Kleibel Collaborative Artists Management

                Tel: 69 9194 7389

                office@a2kmusic.com

                www.a2kmusic.com

                Czerningasse 8/12, Vienna, Vienna A-1020

                Other Information: It manage different talents in the field of music. The company provides a variety of talent for different occasions

                 

                Agentur Hollaender-Calix

                Tel: 13 205 317 Fax: 13 2053 1720

                office.hollaender-calix@chello.at

                www.hollaender-calix.at

                Wehrgasse 28/Top 7, Vienna, Vienna 1050

                manager: Ariane Hollaender-Calix Adrian  Hollaender

                Art Forms: classical

                Other Information: the Artist Agency Hollaender-Calix is a leading agency in the field of opera. They care for renowned artists from the field of classical music and work with the largest opera houses and festivals of the international opera scene together. Its activities range from performing artists to relevant phonograms contacts.

                 

                Ars Media Konzertservice GmbH

                Tel: 662 873 335 0 Fax: 662 874 752

                office@arsmedia-agency.com

                www.arsmedia.at

                Bergstrasse 22/38, Salzburg, Salzburg 5020

                ceo: Freimuth Teufel Hansen Winter

                Art Forms: all

                Other Information: The artist agency ARS MEDIA has successfully operated since 1986 in Salzburg and is very much appreciated as a professional, serious and promising cooperation partner to events, artists, agencies, catering and hotel associates, industrial firms as well as private people.

                 

                artsprojects

                Tel: 664 101 8856

                office@artsprojects.com

                www.artsprojects.com

                Meytensgasse 14, Vienna, Vienna 1130

                owner: Kristel JoselScobieVorrasiPrim

                Art Forms: classical, solo/chamber, symphonic,

                Other Information: For over 25 years artsprojects have been a reliable partner for many international music institutions, as agents as well as in touring and festival management. We offer a broad variety of consulting and management services in the classical music field, as well as in the entertainment and leisure branch.

                 

                Benedikt Weingartner International Artists Management

                Tel: 1 489 6154 Fax: 1 489 6154 44

                office@bwartists.at

                www.BWArtists.at

                Bosendorferstr. 4 / 12, Wien, 1010, Vienna, Vienna 1010

                general manager: Benedikt Weingartner

                Art Forms: classical

                Other Information: Benedikt Weingartner International Artists Management is a talent ageny  specialising in general personal management, local representation, extensive orchestra touring and special projects. It is a member of the European Association of Artist Managers.

                 

                Buchmann Artist Management GmbH

                Tel: 1 203 6357 Fax: 1 204 3750

                office@buchmann.at

                www.buchmann.at

                Schachnerstrasse 27, Vienna, Vienna 1220

                agent: Christian Buchmann; owner: Rudolf Buchmann

                Art Forms: classical, solo/chamber, symphonic, other

                Other Information: The office Künstlersekretariat Buchmann GmbH was founded in 1976 by Prof. Rudolf Buchmann as a family business. The closest connection has always been with the Far East, particularly with Japan. Today, the company works with virtually all the major organisers and cultural partners around the world. Since 2008, the Künstlersekretariat Buchmann GmbH has in addition been responsible for the organisation of the Vienna Philharmonic Summer Night Concert Schönbrunn.

                 

                Cadenza Concert

                Tel: 66 2425 091

                Fax: 66 2330 2268

                office@cadenza-concert.at

                www.cadenza-concert.at

                Beethovenstrasse 30, Salzburg, Salzburg 5020

                administration: Olivia  Mitterhuemer; administration: Marcus Gisperg

                Art Forms: baroque, choral, classical,

                Other Information: The agency Cadenza-Concert was founded in 1993 by Alja Batthyány-Végh. After several years in Zurich, she continued her work in Salzburg. The musical heritage of her father, Sandor Végh, plays an important part creating a spiritual unity with all their artists, some of whom played music or studied with or under him. Since November 2013 Marcus Gisperg  together with Olivia Mitterhuemer - coordinates national and international concerts and tours for soloists, conductors, chamber music ensembles, chamber orchestras, and symphonic orchestras. With particular devotion and personal commitment they try to create a personal atmosphere between presenters worldwide and the artists.

                 

                Da Capo Musikmarketing GmbH

                Tel: 53 7343 3340 Fax: 53 7343 33416

                info@dacapo.at

                www.dacapo.at

                Wildbichler Str. 39, Kufstein, Ebbs 6341

                ceoArt Forms: choral, classical, pops/light classical

                Other Information: The K&K Opernchor was established in 2003. It was formed on the basis of the original Lviv Chamber Choir with its director Vasyl Yatsyniak, who studied under Vladimir Minin in Moscow. He assumed responsibility for the performances of this vocal ensemble from the beginning. Today the K&K Philharmoniker gives around 100 concerts each year  time and again in the Philharmonic and in the Berlin Concert Hall, the Helsinki Music Centre and the Gewandhaus Leipzig, in the Laeiszhalle in Hamburg, the concert halls of Copenhagen, Stockholm, Madrid, Oslo and Paris, and at Vienna’s Musikverein.

                 

                eckartmusic

                Tel: 699 125 59798 Fax: 123 613 429

                office@eckartmusic.com

                www.eckartmusic.com

                Johann-Strauß-Gasse 36/18, Vienna, Vienna 1040

                general manager: Matthias Eckart; administration: Theresa Eckart 

                Art Forms: children/youth, classical, pops/light classical, solo/chamber, symphonic, wind/brass band, other

                Other Information: Provides live music, and organise whole music events. From concerts to operas. Since 1988 they have performed as a flutist in over 1500 concerts, ballroom parties, operas and operetta performances, formed and built up 4 orchestras and managed well over 600 concert productions.

                 

                Esther Schollum Artists’ Management

                Tel: 2236 41004 Fax: 2236 41 0044

                es@estherschollum.at

                www.estherschollum.at

                Guntramsdorfer Strasse 12/2, Vienna, Mödling/Vienna 2340

                managing director: Esther Schollum

                Art Forms: baroque, classical, modern/contemporary, symphonic, vocal, all

                Other Information: Founded in 1992, the aim of Esther Schollum Artists’ Management has always consisted in being a service-link between artists and promoters, a partner to put ideas into practice, an advisor with the necessary know-how. Esther Schollum Artists’ Management works as a concert and opera agency in Europe and overseas; they represent artists in general management or have their regional or local management. It organises orchestra and concert tours and advise promoters and festivals when it comes to programming and casting and it looks for co-productions partners. Member of IAMA.

                 

                Hainzl and Delage Artists Management

                Tel: 699 1706 7405

                office@delage.at

                www.hainzl-delage-artists-management.com

                Postfach 17, Vienna, Vienna 1043

                managing director: Laurent Delage; managing director: Franz Hainzl

                Art Forms: classical, vocal

                Other Information: Hainzl and Delage Artists Management believe that a long-term vision is the best way of creating a relationship based on confidence with its partners who are both artists as well as promoters. It also believes that the credibility of its profession is closely related to the artistic, moral and human principles without any concessions. Member of IAMA.

                 

                IAAC Italartist Austroconcert Kulturmanagement GmbH

                Tel: 15 132 657 Fax: 15 126 154

                austroconcert@ia-ac.com

                www.ia-ac.com

                Gluckgasse 1, Vienna, Vienna A-1010

                ceo & managing director: Elisabetta Hartl; president: Wolfgang Hartl; artistic administration:

                Raphaela  Hödl

                Art Forms: classical

                Other Information: International artists management operating in the fields of opera, concerts and orchestral tour management. Worldwide representation of a luminary roster of artists. Member of IAMA.

                 

                IMZ - International Music and Media Centre

                Tel: 1 8 890 315

                office@imz.at

                www.imz.at

                Stiftgasse 29, Vienna 1070

                secretary general: Franz  Patay ; director: Katharina Jeschke; director: Ruth Pfletschinger 

                Art Forms: children/youth, classical, modern/contemporary, pops/light classical, pop/rock, symphonic, other

                Other Information: The Vienna-based IMZ International Music + Media Centre was founded under the aegis

                • 5. Re: Formatting phone numbers with GREP
                  Obi-wan Kenobi Adobe Community Professional

                  Not clear??

                   

                  less?

                  8: 00000000 => ?

                  9: 000000000 => ?

                  10: 0000000000 => ?

                  11: 00000000000 => ?

                  more?

                   

                  If you want 3-numbers groups with the last one with no less than 1 or 2 numbers, we could have this:

                   

                  6: 000000 => 000 000

                  7: 0000000 => 000 0000

                  8: 00000000 => 000 00000

                  9: 000000000 => 000 000 000

                  10: 0000000000 => 000 000 0000

                  11: 00000000000 => 000 000 00000

                  12: 000000000000 => 000 000 000 000

                   

                  Are you Ok?

                   

                  (^/)

                  1 person found this helpful
                  • 6. Re: Formatting phone numbers with GREP
                    andrewa52355798 Level 1

                    That second option would be really good (your listing 6-12).

                     

                    I also found the search wasn't picking up all the numbers in that data set...

                     

                    Thanks!

                     

                    A

                    • 7. Re: Formatting phone numbers with GREP
                      Obi-wan Kenobi Adobe Community Professional

                      Hi Andrew,

                       

                      Is that really what you want to get, just do it!

                       

                      1 light-saber hit!

                       

                      /*
                          Script written by Michel Allio [2017/01/07]
                          https://forums.adobe.com/thread/2259464
                      */
                      
                      
                      app.doScript("main()", ScriptLanguage.javascript, undefined, UndoModes.ENTIRE_SCRIPT, "Tel/Fax! …");
                      
                      
                      function main()     
                      {
                      
                      
                          var myDoc = app.activeDocument,
                          
                          // --------  add all separator you want! --------  
                          mySeparator = "\\h()[\\]._-";
                      
                      
                          app.findGrepPreferences = app.changeGrepPreferences = null;
                          app.findGrepPreferences.findWhat = "(Tel|Fax):\\h\\K([" + mySeparator + "]*(\\d))+";
                          myFound = myDoc.findGrep( );
                          var F = myFound.length;
                      
                      
                          for ( var f = 0 ; f < F ; f++)
                              {
                              var myTarget = myFound[f];
                              app.findGrepPreferences = app.changeGrepPreferences = null;
                              app.findGrepPreferences.findWhat = "\\D";
                              app.changeGrepPreferences.changeTo = "";
                              myTarget.changeGrep( );
                      
                      
                              app.findGrepPreferences = app.changeGrepPreferences = null;
                              app.findGrepPreferences.findWhat = "(\\d{3})(?=(?1))";
                              app.changeGrepPreferences.changeTo = "$0~s";
                              myTarget.changeGrep( );
                              app.findGrepPreferences = app.changeGrepPreferences = null;
                              }
                      
                      
                      }
                      

                       

                       

                      (^/) 

                      1 person found this helpful