Jump to content

Search the Community

Showing results for tags 'regex greek'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. First of all this is my first post to this great site. Excuse me for not being such an expert in defining my exact problem. I am trying to use spellChecker extension for Horde Webmail. This extension uses aspell. This thing works like a charm for the English version of the spellchecker. I want to use this spellchecker for Greek language. It does not work for greek words. I debugged the whole source code to make a point. Below i ll describe the way this works. When you click the spellcheck it calls the aspell as a cmd and this returns two arrays, one with the bad words and one with the suggestions. This arrays are converted to a Json string and passed to a javascript function that uses 2 regexp in order to match every entry of each bad word. These regular expression works with english strings as I referred like a charm. The way it works is trying to match every bad work and substitute it with a <span> element. The problem is that with greek strings the word matching does not work. Trying to find a solution I encoded to utf8 but this failed. After reading a lot on the internet I found a possible solution with XRegExp but I couldn't make it work. My last chance was to transfer this work to php. So I made xmlHttpRequest for each bad word and use php to make the regexp replacements. But with preg_replace I could not make it work. Below is the actual javascript code: //node is the bad word var re_text = '<span index="'+ (i++) + '" class="spellcheckIncorrect">'+ node + '</span>'; //content is the whole string content = content.replace(new RegExp("(?:^|\\B)" + RegExp.escape(node) + "(?:\\b|$)", 'g'), re_text); // Go through and see if we matched anything inside a tag (i.e. // class/spellcheckIncorrect is often matched if using a // non-English lang). content = content.replace(new RegExp("(<[^>]*)" + RegExp.escape(re_text) + "([^>]*>)", 'g'), '\$1' + node +'\$2'); So I would like to ask your valuable help to bypass my problem with the greek words. I am not a regular expression specialist but I realize that this regex tries to match all words like "node" as a word identified as a word using \b or as the first(^) or last word($) in the whole string , using g. Can anyone suggest a way either using javascript or php (I have implementing to pass all needed information to php and back to javascript using xhr) or any other way. The info about the server I use as a development and production is a solaris 10, php5, apache2. Thanks in advance, and sorry if I couldn't describe well my problem.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.