Find Jobs
Hire Freelancers

Regular expression based text parser in JavaScript

$30-5000 USD

ปิดแล้ว
โพสต์ เกือบ 13 ปีที่ผ่านมา

$30-5000 USD

ชำระเงินเมื่อส่งงาน
Thank you for checking out my project! Before we proceed, this a small coding task intended for individual coders, not teams. You must be a JavaScript and regular expressions expert to complete this task. This task requires you to produce a function which receives two inputs: an Object and Text. Your job is to parse the input text using given object and return expected result which is also shown below. Please note that I tried my best not to make mistakes in the output example, but if something looks like it doesn't follow everything else or there's a character missing, it's probably a mistake. Please confirm with me. There should be NO exceptions in resulting object and if flattened, it should match the input text exactly. Finally, result should not rely on any external libraries or code. Deliverable should be plain JavaScript with no external library dependencies of any kind except what is provided by ECMA. ## Deliverables A few notes: (1) All matches, including begin and end are regular expressions. (2) The patterns could be specified directly or be reused from repository. (3) Recursion is allowed which is accomplished via "include": "#self". **Object Input:** { "name": "source", "patterns": [ { "name": "keyword", "match": "begin|end" }, { "name": "value", "patterns": [ { "include": "#colors" }, { "include": "#numbers" } ] }, { "name": "string", "begin": "'", "end": "'", "patterns": [ { "name": "[login to view URL]", "match": "\\\\." } ] }, { "name": "script", "begin": "#{", "end": "}", "patterns": [ { "include": "#self" } ] } ], "repository": { "colors": [ "name": "color", "match": "red|blue" ], "numbers": [ "name": "number", "patterns": [ { "name": "integer", "match": "\\d+" }, { "name": "float", "match": "[\\d\\.]+" } ] ] } } **Text Input:** This is a string: "hello world, #{ this should all be a string }". This is an escaped string: "Hello \"wonderful\" world. Lets end our troubles and begin new life!". Here are some keywords: Lets end our troubles and begin new life! Here are some values: Sky is blue, roses are red and so is 10000 and 10.42. And here's the recursion test: #{ This is a string: "hello world, #{ this should all be a string }". This is an escaped string: "Hello \"wonderful\" world. Lets end our troubles and begin new life!". Here are some keywords: Lets end our troubles and begin new life! Here are some values: Sky is blue, roses are red and so is 10000 and 10.42. And here's the recursion test: #{ "string" } } **Output:** The name of a pattern is used as a key. If there's no pattern capturing, plain string is included. Begin/end are implicitly captured with "begin" and "end" names. { "source": [ "This is a string: ", { "string" : [ { "begin": "\"" }, "hello world, #{ this should all be a string }", { "end": "\"" } ] }, ".\nThis is an escaped string: ", { "string" : [ { "begin": "\"" }, "Hello \"wonderful\" world. Lets end our troubles and begin new life!", { "end": "\"" } ] }, ".\nHere are some keywords: Lets ", { "keyword": [ "end" ] }, " our troubles and ", { "keyword": [ "begin" ] }, " new life!\nHere are some values: Sky is ", { "value": [ { "color": [ "blue" ] } ] }, ", roses are ", { "value": [ { "color": [ "red" ] } ] }, " and so is ", { "value": [ { "number": [ { "integer": "10000" } ] } ] }, " and ", { "value": [ { "number": [ { "float": "10.42" } ] } ] }, ".\n\nAnd here's the recursion test:\n", { "script": [ { "begin": "#{" }, { "source": [ "\n\tThis is a string: ", { "string" : [ { "begin": "\"" }, "hello world, #{ this should all be a string }", { "end": "\"" } ] }, ".\n\tThis is an escaped string: ", { "string" : [ { "begin": "\"" }, "Hello \"wonderful\" world. Lets end our troubles and begin new life!", { "end": "\"" } ] }, ".\n\tHere are some keywords: Lets ", { "keyword": [ "end" ] }, " our troubles and ", { "keyword": [ "begin" ] }, " new life!\n\tHere are some values: Sky is ", { "value": [ { "color": [ "blue" ] } ] }, ", roses are ", { "value": [ { "color": [ "red" ] } ] }, " and so is ", { "value": [ { "number": [ { "integer": "10000" } ] } ] }, " and ", { "value": [ { "number": [ { "float": "10.42" } ] } ] }, ".\n\tAnd here's the recursion test:\n", { "script": [ { "begin": "#{" }, " ", { "string" : [ { "begin": "\"" }, "string", { "end": "\"" } ] }, " ", { "end": "}" } ] }, "\n" ] }, { "end": "}" } ] } ] }
รหัสโปรเจกต์: 3495891

เกี่ยวกับโปรเจกต์

3 ข้อเสนอ
โปรเจกต์ระยะไกล
ใช้งานอยู่ 13 ปีที่ผ่านมา

กำลังมองหาการสร้างรายได้ใช่ไหม?

ประโยชน์ของการประมูลกับ Freelancer

กำหนดงบประมาณและกรอบเวลาของคุณ
รับเงินจากการงานของคุณ
อธิบายข้อเสนอของคุณในภาพรวม
ลงทะเบียนและเสนอราคาฟรี
3 ฟรีแลนซ์กำลังเสนอราคาโดยเฉลี่ย $383 USD สำหรับงานนี้
รูปอวาตาร์ของผู้ใช้
See private message.
$1,020 USD ใน 10 วัน
4.7 (131 รีวิว)
7.8
7.8
รูปอวาตาร์ของผู้ใช้
See private message.
$42.50 USD ใน 10 วัน
4.9 (14 รีวิว)
3.5
3.5
รูปอวาตาร์ของผู้ใช้
See private message.
$85 USD ใน 10 วัน
0.0 (0 รีวิว)
0.0
0.0

เกี่ยวกับลูกค้า

ปักธงของ CANADA
Toronto, Canada
5.0
1
เป็นสมาชิกตั้งแต่ ธ.ค. 24, 2007

การยืนยันลูกค้า

งานอื่นๆ จากลูกค้ารายนี้

Minor changes to PokerSource (python)
$495-500 USD
Convert MediaWiki site to Markdown
$30-100 USD
ขอบคุณ! เราได้ส่งลิงก์สำหรับเครดิตฟรีให้คุณทางอีเมลแล้ว
เกิดข้อผิดพลาดขณะส่งอีเมลของคุณ กรุณาลองอีกครั้ง
โลโก้ Freelancer Thailand / ภาษาไทย ช่วยเหลือและสนับสนุน FreelancerประเภทโปรเจคการประกวดFreelancerองค์กรแพ็กเกจสมาชิกโครงการ Freelancer ชั้นแนวหน้าการจัดการโปรเจคงานในพื้นที่Photo Anywhereหน้าจัดแสดงผลงานAPI สำหรับนักพัฒนาได้รับการยืนยันDesktop App เกี่ยวกับเกี่ยวกับเราวิธีใช้งานความปลอดภัยนักลงทุนแผนผังเว็บไซต์เรื่องราวข่าวออกสื่อทีมรางวัลข่าวประชาสัมพันธ์ร่วมงานกับเรา ข้อกำหนดนโยบายความเป็นส่วนตัวข้อกำหนดและเงื่อนไขนโยบายลิขสิทธิ์ข้อพึงปฏิบัติค่าธรรมเนียมและค่าบริการหุ้นส่วนEscrow.comLoadshiftWarrior Forum แอปโลโก้ Apple App Store โลโก้ Google Play
ไม่สามารถคัดลอกไปยังคลิปบอร์ดได้ โปรดลองอีกครั้งหลังปรับเปลี่ยนการอนุญาต
คัดลอกไปยังคลิปบอร์ดแล้ว
ผู้ใช้ที่ลงทะเบียน งานที่มีการโพสต์ทั้งหมด
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
กำลังโหลดตัวอย่าง
ได้รับอนุญาตสำหรับตำแหน่งทางภูมิศาสตร์
เซสชั่นการเข้าสู่ระบบของคุณหมดอายุและคุณได้ออกจากระบบแล้ว กรุณาเข้าสู่ระบบอีกครั้ง