Regular Expression (REGEX)
REGULAR EXPRESSION is a powerful and dynamic find and replace language you can use to create links in your publication.
EG. You could choose all instances of “MYCOMPANY” to become a link to the MYCOMPANY.COM website OR create dynamic links based on a product or inventory table in your publication (IE Product ABC-123456 will create a link www.mycompany.com/ABC-123456)
More Information on regular expressions can be found at the following websites:
www.regular-expressions.info
www.zytrax.com/tech/web/regex.htm
geekswithblogs.net/brcraju/articles/235.aspx
Create a REGEX job
You can get to the autolink section through the "Enhance" button/dropdown menu to the right of your mini thumbnail in the title view.
Select "New Auto-Link Job"
Select Regular Expression as your "Job Type" and the required fields you need to fill out will appear
Job Name:
Type a meaningful name for this job(IE Product Code Link Job, Company Name Link Job)
Search For:
This is where you type your REGEX code.
Simple REGEX: This can be a simple word or phrase REGEX such as companyname, which will search for all instances of companyname and create a link.
To make the search smarter to find all instances whether upper or lower case characters, the REGEX would be:
[cC][oO][mM][pP][aA][nN][yY][nN][aA][mM][eE]
The above expression accounts for all lower and upper-case combinations
eg. companyname, CompanyName , ComPanYnaME
Dynamic REGEX: This can be a complex REGEX which will intelligently find and create links based on a certain format. Using the product code example above( ABC-123456), the REGEX would be:
[A-Za-z][A-Za-z][A-Za-z].[0-9][0-9][0-9][0-9][0-9][0-9]
This REGEX would recognize all codes listed below in the first column.
Replace With (link):
This is the section where you designate what link to create when the REGEX finds a value.
The First field is for the piece of the link that is NOT going to change. Always start with at least http://
The Second field is for the dynamic part of the link that is going to be created based on the text the REGEX finds. You can use the whole REGEX here or a subset of the REGEX.
The Third field is for any content that you would like to be appended to the end of the link. This of course depends on the targets you are linking to.
In the Simple REGEX example above, we just want a link to the companyname website so we would enter http://www.companyname.com in the First field. No other fields are needed for this case.
In the Dynamic REGEX example above, we would need the base website addressthat will appear for all links created eg(http://www.companyname.com/) in the First field. The Second Field is where you will enter the dynamic part of the link. In this case you could include the REGEX, [A-Za-z][A-Za-z][A-Za-z].[0-9][0-9][0-9][0-9][0-9][0-9], in order to create the link based on that found text (EG http://www.companyname.com/ABC-123456). Finally the Third field could include a webpage format (.htm,.html), OR referral or Affiliate script suffix (EG ?MygazinesReferral).
The entire link using these values would be:
http://www.companyname.com/ABC-123456.htm
OR
http://www.companyname.com/ABC-123456?MygazinesReferral
Hovertip:
This is an optional field where you can enter a hovertip value for all of the links created. If nothing is entered here, the hovertip will be the target link URL
Test Case:
In order to create a REGEX job, we must first make sure the search works. Enter some text that matches your defined REGEX.
For the simple REGEX above, a test case that would pass could be companyname, CompanyName, or CoMpAnynAme. Companyname would not pass this test.
For the dynamic REGEX above, a test case that would pass could be abc-123456, ThR-534876, or BGr-098765. C-12345 would not pass the test.
The test case MUST pass before the Job can be created.
Check the "Automatically Enable All Links Found" option if you would like all links created to be active. If you don't check this option, you will need to review all of the links created by your job, and enable them manually through the "Manage Auto-Links" page.
Click "Create Job" and you will be brought to the Manage Auto-Links page automatically to review your Job(s)
Manage Auto-Links
Your REGEX Job will create a Task under which all of your links will be created (click on the Job to see the task)
Click on the Task to see the links created by that task.
At that point you will see a list of all links created and you can choose to enable/disable/delete. You can also delete the entire Job in the tasks window.
Use the Custom Regex Autolink Job On upload
Once you create a custom regex Job, it will be available to be run when you upload a new issue, along side the default website/emails default job.
Comments
0 comments
Please sign in to leave a comment.