How to combine several regex queries into a script?

Hi there,
is it possible to combine several regex queries into a javascipt? I export the text from a database with custom tags and the regex queries perform text AND character style replacements.
example
Let's say my exported text is the following
"I have a <tag_bold>very big text</tag_bold> that includes a lot of different character styles, such as <tag_bold>bold</tag_bold>, <tag_italic>italic</tag_italic>, <tag_bold>bold with some <tag_bold_underline>underlined words</tag_bold_underline></tag_bold>,
or ever words with different <tag_size-2>text size</tag_size-2>"
The result I want is
"I have a very big text that includes a lot of different character styles, such as bold, italic,
bold with some underlined words, or ever words with different text size"
Notice that all the tags open and close in the same paragraph and that there are nested tag pairs in some cases. So i execute my queries (more than 20) from the outer pair to the inner, that is:
<tag_bold>...</tag_bold>
<tag_italic>...</tag_italic>
<tag_size-2>...</tag_size-2>
<tag_bold_underline>...</tag_bold_underline>
Thanks in advance for your help
dps

Hi Shonky,
thank you for your answer. It seems that it is very close to the solution.
1) I see now that my question was not clear enough.
In the text that is included between the tags, I want to apply a Character Style I have define in the character style palette of InDesign CS3.
That style can contain a lot of options, such as font family, size, style or color changes and is different for each tag.
2) I tested the function with my tags:
function my_replace (tag_bold)
app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.findWhat = '<' + 'tag_bold' + '>' + '(.+?)</' + 'tag_bold' + '>';                     // here is the name i use in the regex tag
app.changeGrepPreferences.changeTo = '$1';
app.changeGrepPreferences.fontStyle = 'tag_bold';                                //here is the name of the Character Style I have define in InDesign
app.activeDocument.changeGrep();
app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences = NothingEnum.nothing;
result: nothing happens
3) Using in the script only the body of the function and running it, it highlights the right words with that pink color and shows that the Style of the text is "tag_bold", which is not available in the font family I use (Minion Pro).
I think that the function needs a modification in the line "app.changeGrepPreferences.fontStyle = 'tag_bold';", especially the "fontStyle" attribute, but I don't know what it is. I'm not a javascript expert and maybe I don't know the right way to use this function with InDesign. I read some books about InDesign Scripting and Regular expressions, but  I didn't found all the answers I need as the one above or how I can run all the queries in one script (this is necessery because of the number and the order of scripts, to avoid mistakes).
Thanks
dps

Similar Messages

  • How to combine several .MOV's into a single .MOV video?

    Hi all,
    I want to make a video xmas card for one of my friends. I would like to film several little tid-bits of myself in different places saying random stupidities but would like her to receive it in only one video instead of several.
    I use a basic digital camera that has video. When I transfer the videos to my mac, they come out in .MOV format.
    HOw do I stitch all of these together?
    I hope I dont need to buy something!
    Thanks a million

    Have you tried using iMovie? It is part of the iLife suite which comes preinstalled on all Macs.

  • How to combine below 4 queries into a single query?

    SELECT COUNT(*) AS NORMAL_PASS
    FROM (
    SELECT MAINSERNO
    FROM SGSTUDENT.PPL_PRODUCT_TESTID2
    WHERE (MONO = '5954556' AND TESTMODE =1 AND TESTFLAG =1)
    SELECT COUNT(*) AS NORMAL_FAIL
    FROM (
    SELECT MAINSERNO
    FROM SGSTUDENT.PPL_PRODUCT_TESTID2
    WHERE (MONO = '5954556' AND TESTMODE =1 AND TESTFLAG =2)
    SELECT COUNT(*) AS REPEAT_PASS
    FROM (
    SELECT MAINSERNO
    FROM SGSTUDENT.PPL_PRODUCT_TESTID2
    WHERE (MONO = '5954556' AND TESTMODE =2 AND TESTFLAG =1)
    SELECT COUNT(*) AS REPEAT_FAIL
    FROM (
    SELECT MAINSERNO
    FROM SGSTUDENT.PPL_PRODUCT_TESTID2
    WHERE (MONO = '5954556' AND TESTMODE =2 AND TESTFLAG =2)

    Are you looking for the below:
    SELECT COUNT(*) as Cnt, 'NORMAL_PASS' as [Type]
    FROM (
    SELECT MAINSERNO
    FROM SGSTUDENT.PPL_PRODUCT_TESTID2
    WHERE (MONO = '5954556' AND TESTMODE =1 AND TESTFLAG =1)
    Union All
    SELECT COUNT(*) , 'NORMAL_FAIL'
    FROM (
    SELECT MAINSERNO
    FROM SGSTUDENT.PPL_PRODUCT_TESTID2
    WHERE (MONO = '5954556' AND TESTMODE =1 AND TESTFLAG =2)
    Union All
    SELECT COUNT(*) , 'REPEAT_PASS'
    FROM (
    SELECT MAINSERNO
    FROM SGSTUDENT.PPL_PRODUCT_TESTID2
    WHERE (MONO = '5954556' AND TESTMODE =2 AND TESTFLAG =1)
    Union All
    SELECT COUNT(*) , 'REPEAT_FAIL'
    FROM (
    SELECT MAINSERNO
    FROM SGSTUDENT.PPL_PRODUCT_TESTID2
    WHERE (MONO = '5954556' AND TESTMODE =2 AND TESTFLAG =2)
    Or
    SELECT MAINSERNO,Count(Case when TESTMODE =1 AND TESTFLAG =1 Then 1 Else NULL End) as 'Normal_Pass',
    Count(Case when TESTMODE =1 AND TESTFLAG =2 Then 1 Else NULL End) as 'Normal_Fail',
    Count(Case when TESTMODE =2 AND TESTFLAG =1 Then 1 Else NULL End) as 'Repeat_Pass',
    Count(Case when TESTMODE =2 AND TESTFLAG =2 Then 1 Else NULL End) as 'Repeat_Pass'
    FROM SGSTUDENT.PPL_PRODUCT_TESTID2
    WHERE (MONO = '5954556')

  • How to combine several files into one?

    How to combine several pdf files into one?

    Combine Files is a feature of Acrobat Pro.  Because Reader Touch does not support the feature (yet), this is not the right forum for the question.
    Here's the Acrobat forum for Creating, Editing & Exporting PDFs.
    http://forums.adobe.com/community/acrobat/creating__editing_%26_exporting_pdfs
    You can ask questions and get help from Acrobat experts there.  Good luck!

  • How do I combine several pdf files into one so I can send them as one file.

    how do I combine several pdf files into one so I can send them as one file

    Reader doesn't have that ability. You would need Acrobat.

  • How do I combine several pdf files into a single file (MAC OS)?

    How do I combine several pdf files into a single file ?
    MAC OS 10.6.8
    Adobe Reader 11.0.10
    Signed: Ken, in Utah

    Not possible with Reader. You need Acrobat or a subscription to something like PDF Pack to do it.

  • How to combine several measures into 1 pie chart

    Hello everyone,
    I have a requirement to create a design studio application with a pie chart to show several measures.
    It means that I have several different measures and I want to let each piece of the pie chart present 1 measure.
    For example, I need to combine measure1 ,measure2, measure3(which correspond KeyFigures in Bex query) into 1 pie chart and there should have 3 pieces.I tried change swap axis option and put all measures into row, not works.
    I am very appreciate if anyone could help. Thanks a lot.

    Hi !
    There is a tricky way to do that.
    Read the following document How to combine several measures into 1 Pie chart
    hope it helps,
    Roman

  • Combine several pdf docs into one single pdf doc

    I need to combine several pdf's into one pdf. How can I do this?

    Or with non-Adobe programs that you may find by Googling...

  • How to Combine Multiple Physical Queries

    Hi All,
    I have a big reports with over 70-80 columns in Answer. This is not a Pivot report. Now it is generating 3 physical queries .
    I need to merge this 3 queries into a single query. But it seems very hard to implement.
    Couple of points:
    1. Report is generating 3 physical queries. All queries are GROUP BY queries and each of them giving different count separately
    2. If we find a way to combine. The result would be different from Answers Report Result (This is my assumption)
    3. How Answer is combining the results from 3 queries and showing us the result?
    Any input or thought is high appreciated.
    I'm totally stuck in there. Tried different ways. But is there any solution for this that I'm not able to think?
    Pls Help
    Thanks in Advance
    Regards
    Sudipta

    Hi Kranthi,
    Thanks for you reply.
    I need to combine multiple report queries into one and give it to ETL guys. I don't have to do anything in Answers. This is my requirement.
    I'm good in SQL. So I tried to combine like the following. Taking a small scenario.
    In this case, Anlytics is generating following 2 queries:
    Query 1:
    select sum(x), [Fact column]
    sum(y), [Fact column]
    column1, [Dim column]
    column2, [Dim column]
    column3, [Dim column]
    from table1,table2,table3
    where [All joins]
    group by column1,column2,column3
    Query 2:
    select sum(z), [Fact column]
    column1, [Dim column]
    column2, [Dim column]
    column3, [Dim column]
    from table1,table2,table3
    where [All joins]
    group by column1,column2,column3
    I'm trying to combine it:
    Query 1:
    select sum(x), [Fact column]
    sum(y), [Fact column]
    sum(z), [Fact column]
    column1, [Dim column]
    column2, [Dim column]
    column3, [Dim column]
    from
    (select sum(x), [Fact column]
    sum(y), [Fact column]
    column1, [Dim column]
    column2, [Dim column]
    column3, [Dim column]
    from table1,table2,table3
    where [All joins]
    group by column1,column2,column3
    ) q1,
    select sum(z), [Fact column]
    column1, [Dim column]
    column2, [Dim column]
    column3, [Dim column]
    from table1,table2,table3
    where [All joins]
    group by column1,column2,column3
    ) q2
    where
    q1.column1=q2.column1 and
    q1.column2=q2.column2 and
    q1.column3=q2.column3
    But i think it is not the correct way may be, as i'm getting a bit different count. So the where conditions are not matching for the 2 queries above.
    Any thought on this?
    Thanks
    Sudipta

  • Acrobat XI PRO: Create a Table of Contents (TOC) automatically in top, after I have combined several pdf.files into a single pdf.file

    Hey
    I have now tried for hours, but now I give up!
    MY WISH -
    Create a Table of Contents (TOC) automatically after I have combined several pdf.files into a single pdf.file.
    I have already bookmarks, shown on the screen (see screenshot below) but I want those bookmark to be visualised in a separate TOC in the top of the combined files.
    This new TOC (which I have inserted) shall be printable and serve as a cover page in a binder.
    I have seen other cheap pdf.programs in the market (e.g. PDF Converter Professional 7.3) which are able to make the above things, easy, fast and nice.
    Regards
    Ole Bünger, Kristianstad Sweden

    Somewhat roundabout way but this should work:
    Is there easy way to print bookmarks Acrobat Pro 9.5

  • How to include several PDF documents into just one file?

    I have a Word document with 6 pages that I saved in PDF.
    I wanted to transform the entire document in JPEG (JPG) immage, so that I could use it in other tools, such as Facebook for example.
    The problem is that using Adobe Photoshop it opens and saves page by page.
    Can you give me s solution or hint?
    Flavio
    [email protected]

    Thank you!
    I already saved all pages as .pdf w/ Acrobat and have all 6 pages saved in
    .jpg, using Photoshop.
    Problem is that I want to post the whole text in my Facebook page, and to
    have it in six pieces is not quite readable...
    Thanks anyway and have a joyful Xmas!
    2011/12/24 try67 <[email protected]>
       Re: How to include several PDF documents into just one file?  created
    by try67 <http://forums.adobe.com/people/try67> in Adobe Reader - View
    the full discussion <http://forums.adobe.com/message/4102594#4102594>

  • How to combine a one columns into 1?

    I am using Oracle 8i,
    I want to know that how to combine a one columns into 1 row:
    For example:
    ITEM_NO NAME
    01 ABC
    01 CDE
    Result Set:
    ITEM_NO NAME
    01 ABC; CDE
    I have try to use "SYS_CONNECT_BY_PATH" this function, however, that function can use in Oracle 9i or 10g, NOT 8i.
    So please please help me to solve that. Many thanks.

    Check this thread
    Re: column values separated by ,

  • Combining several iMovie projects into one, time-not space-being the factor

    Hello,
    Space is not an issue (large external drive), but I'm trying to figure out the fastest way to combine several iMovie projects into one (so each movie will become a chapter in iDVD). I'm pretty sure there must be a better way than I'm attempting, selecting all the clips in clipviewer, then dragging and dropping to the new project clipviewer. As I've done this, the "time remaining" window keeps growing (started out about 4 minutes, climbed to "92 minutes remaining," then I aborted the move). Details: each movie is about 8-10 minutes long, widescreen, made up of various (sometimes many) dv clips, audio segments, still photos, etc.
    I have added dv clips to a project via the media folder (project unopened), but this was a single item and simple to move from trash into the project. In this case, I'm not sure what to move in order to save the entire project intact.
    Thanks so much for any help,
    b
    Message was edited by: Bimp

    Thanks for your reply, Klaus. I'm just now getting to try your suggestion to copy and paste from timeline rather than drag and drop from clipviewer. Alas, it seems to be choking terribly on the transfer. This video is not a 60 minute movie, either; it's about ten minutes. I has about 60 files to it. I did get to the point where I felt confident enough to empty the trash and save the project, so I assume the clips that are there are not still "attached" to the unedited dvs.
    Earlier I tried to export, in the advanced settings, to the full quality dv, but the quality really dropped, way too much for the intended use. I'm pretty much stumped at this point, unless I can hear some other suggestions.
    What I might try doing is simply dragging and dropping all the packet contents of the media folder into the other movie's media folder, but then I suspect I'll have to rebuild the darn thing from bits and pieces and it may be like putting Humpty Dumpty back together again...ugh.
    I'm sure I'm not the first person to face this challenge, am I? Of course, my lesson learned is to build one dvd's contents in one imovie project. If it weren't for the fact that I need to offer viewers the option to "play movie" (play all the videos as one movie) I'd simply drag each movie into iDVD and do it that way (the dvd showing each video separately).
    Would still love to hear of other possible solutions here, before trying some other forum.
    thanks!
    B

  • How to merge several customizing requests into a workbench request?

    Dear experts:
      could you tell me How to merge several customizing requests into a workbench request in t-code:SE03?
    thanks
    Edited by: feng Qiu on Nov 4, 2008 3:24 AM

    Hi,
    Refer this:
    Re: Customizing Request's contents - Transfer them to a new request
    http://help.sap.com/saphelp_nw2004s/helpdata/EN/d4/34196a249711d3b29e0000e817ab98/content.htm
    I believe you need to do this from SE09/SE10.

  • How to change multi Find-Change Queries into a scripting

    I was wondering if possible transcribe multi Find-Change Queries into a scripting?
    If it is possible, can someone tell me how?

    1) Buy something and charge the rest to a credit card.
    2) Ask Apple to keep the balance.
    iTunes Customer Service Contact - http://www.apple.com/support/itunes/contact.html

Maybe you are looking for