Tapatalk

Putting link tags on jokes section with different decimal id

Putting link tags on jokes section with different decimal id

81
Advanced UserAdvanced User
81

    Jul 24, 2016#1

    I have a file which has sections links in the form ranging from a.b , a.b.c to a.b.c.d where a,b,c and d are number variables and I want to perform a replace
    which will put appropriate linking tags on it.
    sample

    <sec id="sec1.6.1">
    <p>Where are technologies heading in 1.6.1 the next 30 years ? How will they affect 1.6.6 our lifestyle and human society ?</p>
    <sec id="sec1.6.1.6">
    <p>Most adults alive today grew up without the Internet or mobile phones, let alone 3.2.6.1 smartphones and tablets 6.2 with voice commands and apps 1.2.13 for everything. These new technologies have altered our lifestyle in a way few of us could have imagined a few decades ago. But have we reached the end of the line ? What else could turn up that could make our lives so much more different ? Faster computers ? More gadgets ? It is in fact so much more than that. Technologies have embarked on an exponential growth curve and we are just getting started. In 10 years we will look back on our life today and wonder how we could have lived with such primitive technology. The gap will be bigger than between today and the 1980’s. Get ready because you are in for a rough ride.</p>
    <sec id="sec16.5">
    ARTIFICIAL INTELLIGENCE (AI), SUPERCOMPUTERS & ROBOTICS
    <p>Ray Kurzweil, Google’s director of engineering, 2.0.2.6,4.1.0.2, 3.1.1 predicts that by 2029 computer will exhibit 4.4.0.3 intelligent behaviour equivalent to that of a human, and that by 2045 computers will be a billion times more powerful than all of the human brains on Earth. Once computers can fully simulate a human brain and surpass it, it will cause an “intelligence explosion” that will radically change civilization. The rate of innovation will progress exponentially, so much that it will become impossible to foresee the future course of human history. This point in time is called thesingularity. Experts believe that it will happen in the middle of the 21st century, perhaps as early as 2030, but the median value of predictions is 2040.</p>
    <p>Let’s start with cognitive computing. IBM’s Watson computer is already capable of reading a million books a 3.3.6.0 second and answering 1.1 questions posed in natural language. In 2011 Watson easily defeated former champions Brad Rutter and Ken Jennings at the TV game show Jeopardy!, reputedly one of the most difficult quiz competitions in the world. Watson’s abilities are not merely limited to finding the relevant facts and answers. It can also make jokes and clever puns. Most remarkably, Watson can provide better medical diagnostics than any human medical doctor, give financial advice, as well as generate or evaluate all kinds of scientific hypotheses based on a huge amount of data. Computer power increases in average 100 fold every 10 years, which means 10,000 fold after 20 years, and 1 million fold after 30 years. Imagine what computers will be able to do by then.</p>
    <p>The X Prize Foundation, chaired by Peter Diamandis, co-founder of Singularity University in the Silicon Valley, manages 10.5.3.4 incentivized competitions 3.0.3 to bring about radical breakthroughs for the benefit of humanity. One of the current competitions, the Nokia Sensing XCHALLENGE, aims at developing a smartphone-like device that can test vitals like cholesterol, blood pressure, heart rate or allergies, analyse your DNA for genetic risks, diagnose medical conditions, and predict potential diseases or the likelihood of a stroke. All this without seeing a doctor. The device could be used by you or your relatives anywhere, anytime. All this is possible thanks to highly sensitive electronic sensors and powerful AI.</p>
    <p>3.6.4, 2.1.3, 3.6.8.7 Google is working 4.7.8.3 on an AI that will be able to read and understand any document, and learn the content of all books in the world. It will be able to answer any 1.5.1.6 question asked by any user. This omniscient AI will eventually become people’s first source of knowledge, replacing schools, books and even human interactions. Just wonder about anything and the computer will provide you with the answer and explain it to you in a way you can easily understand, based on your 3.1 current knowledge (1.2.4.1, 2.2.1.3).</p>

    All the red colors will be a link in form <a href id="sec1.1">1.1</a>, <a href id="sec1.1.1">1.1.1</a> and so on.
    I have tried search "^([~sec]^)^([0-9]+^).^([0-9]+^).^([0-9]+^).^([0-9]+^)"
    replace with "^1<xref ref-type="section" id="sec^2.^3.^4.^5">^2.^3.^4.^5</xref>"
    for all 4 digit + dot combination but then I cannot use the same technique to replace the 1.1 and 1.1.1 type replaces
    Can anyone help :cry: :cry:

    19176
    MasterMaster
    19176

      Re: Putting link tags on sections with different decimal id's?

      Jul 24, 2016#2

      Hi don_bradman,

      you could try this Perl replace:

      Find what:
      (\d+(\.\d+)++)(?!">)

      Replace with:
      <xref ref-type="section" id="sec\1">\1</xref>

      BR, Fleggy

      EDIT1: added ">" to lookahead to make the pattern a little bit safer

      81
      Advanced UserAdvanced User
      81

        Re: Putting link tags on sections with different decimal id's?

        Jul 24, 2016#3

        Thanks fleggy :mrgreen: