## 原文
Having opened this cookbook, you are probably eager to inject some of the ungainly strings of parentheses and question marks you find in its chapters right into your code. If you are ready to plug and play, be our guest: the practical regular expressions are listed and described in Chapters 4 through 9.
But the initial chapters of this book may save you a lot of time in the long run. For instance, this chapter introduces you to a number of utilities-some of them created by the authors, Jan and Steven-that let you test and debug a regular expression before you bury it in code where errors are harder to find. And these initial chapters also show you how to use various features and options of regular expressions to make your life easier, help you understand regular expressions in order to improve their performance, and learn the subtle differences between how regular expressions are handled by dif- ferent programming languages-and even different versions of your favorite programming language.
So we’ve put a lot of effort into these background matters, confident that you’ll read it before you start or when you get frustrated by your use of regular expressions and want to bolster your understanding.
## 譯文及剖析
Having opened this cookbook, you are probably eager to inject some of the ungainly strings of parentheses and question marks you find in its chapters right into your code. If you are ready to plug and play, be our guest: the practical regular expressions are listed and described in Chapters 4 through 9.
當打開這本書的時候,你或許想將從此書的某些章節里找到的用括號和問號構成的生僻字符串放到你的代碼里,如果你準備好用這樣的方式即插即用,那么你就是我們的客戶:4到9章將介紹實戰用的正則表達式。
**having opened的時態沒有翻譯出來;ungainly的意思是”難看、笨拙的“,翻譯錯了;”你或許想將從此書的某些章節里找到的用括號和問號構成的生僻字符串放到你的代碼里“太長,應當切開;plug and play翻譯為”即插即用“有點奇怪,可考慮改為”隨查隨用“、”即抄即用“;be our guest的意思弄錯了,應當是”請隨意“;practical的意思不是”實戰“,而是”實際用得上的/有實際用途的“,list and describe不能簡單用”介紹“來翻譯。**
But the initial chapters of this book may save you a lot of time in the long run. For instance, this chapter introduces you to a number of utilities-some of them created by the authors, Jan and Steven-that let you test and debug a regular expression before you bury it in code where errors are harder to find. And these initial chapters also show you how to use various features and options of regular expressions to make your life easier, help you understand regular expressions in order to improve their performance, and learn the subtle differences between how regular expressions are handled by dif- ferent programming languages-and even different versions of your favorite programming language.
而核心的章節主要是讓你少走彎路。例如這一章將介紹很多作者寫的工具,這些工具使你能夠在正則表達式正式加入到那些錯誤難以掌控的代碼之前做測試跟 調試。并且這些核心章節使你了解多種正則表達式之特性和選項的用法從而使你的生活更輕松,使你理解正則表達式從而能夠強化正則表達式的性能,以及明白不同 編程語言甚至同種編程語言的不同版本在處理正則表達式上的細微差異。
**in the long run沒有翻譯出來;initial的意思(兩處)翻譯錯了;may的意思沒表達出來;utilities只有一部分是Jan和Steven寫的;”做跟蹤和調試“的對象不明確,”錯誤難以掌控的代碼“完全偏離原文,原文意思是”代碼中的錯誤很難掌控“;”從而使“的說法太累贅,可直接改為”讓你的生活更輕松“;”從而能夠強化正則表達式的性能“累贅且搭配不當,可改為”提升/優化正則表達式的性能“;”以及“可改為”并“;最后一句的favorite沒有翻譯出來。**
So we’ve put a lot of effort into these background matters, confident that you’ll read it before you start or when you get frustrated by your use of regular expressions and want to bolster your understanding.
所以我們花了大量精力來解決上述技術背景的問題,只是為了讓你在開始或已經處于正則表達式的困擾并希望得到解脫之時能讀到這本書。
**“背景的問題”不通順,可直接翻譯為“背景知識”、“背后的問題”;“只是為了讓你在開始或已經處于正則表達式的困擾并希望得到解脫之時能讀到這本書”太長,應當把“開始”和“已經陷入困擾”切開為兩個分局;bolster your understanding可翻譯為“深化理解”,而不是“得到解脫”。**
## 總評
這是某本技術書籍中的序言,語言淺顯直白,沒有出現太多典故。一般的技術人員都可以讀懂原文,但是翻譯這類文字,需要更多的耐心和細致。
譯文并不妨礙讀者理解原文的主要意思,但小的缺陷很多,許多單詞和短語的意思翻譯錯了,比如第二段的initial和favorite,或者干脆漏掉沒有翻譯,比如第二段的in the long run和may。對于序言來說,這些問題不大,如果是細致講解原理的文字,這樣的缺陷就非常要命,失之毫厘,差之千里。
譯文的另一個問題是長句太多,比如“這些工具使你能夠在正則表達式正式加入到那些錯誤難以掌控的代碼之前做測試跟調試”,“使你理解正則表達式從而能夠強化正則表達式的性能,以及明白不同編程語言甚至同種編程語言的不同版本在處理正則表達式上的細微差異”,在閱讀時它們都會影響到讀者的理解,應當按照中文的習慣拆分開來,比如第一句就可以拆分為“依靠這些工具,你事先測試并調試好正則表達式,再放入代碼,因為在代碼中找出正則表達式的錯誤更加困難”。