All Questions
Tagged with punctuation php
29 questions
1
vote
1
answer
224
views
Add a space between dot or comma and a letter but with some exceptions
I need to do some grammar validation, for example add spaces after dots. Problem is that it shouldn't be done everywhere like in e.g. or www.example.co. or some more advanced exceptions like 999.77.SA....
0
votes
2
answers
785
views
Remove unfinished sentence at the end of a block of text
Here is a given text:
The universe is so big that it’s impossible to comprehend. Our solar
system is just a tiny speck in the vastness of space. And our galaxy,
the Milky Way, is just one of billions ...
1
vote
0
answers
64
views
Arabic punctuation appearing in incorrect positions on live DigitalOcean server but fine on XAMPP localhost
The text has one full stop and two commas and appears fine on my localhost (second sentence in bold)
يمكن للزبون استبدال المنتج خلال ثلاثة أيام من تاريخ الشراء، ولا يوجد استرجاع للمبالغ النقدية. في ...
1
vote
2
answers
310
views
How to replace (.) dots by (·) interpuncts in PHP?
There's a French typographic rule to write properly some words in a genderless way, by adding an (·) interpunct between letters.
A few authors on my website are however typing a simple (.) dot instead....
0
votes
2
answers
72
views
How to fix joined words problem, after RegEx removes spaces from punctuation?
My RegEx code removes spaces from the left and right side of the punctuation inside the string. after removing those spaces, the result is okay but some words have joined together.
I tried to change ...
0
votes
1
answer
76
views
Cleaning up a string with punctuation mistakes and missing spaces
Hi, I have the following string:
TheLion is walking(proudly) through theJungle,but he misses hisTeddy.1very sad day!It is VegeterianDay,too. How can we help him?Maybe withBambi&a good song! Or ...
1
vote
1
answer
135
views
Make the first sentence in each paragraph an <H3> by referencing two break tags and the next period, question mark, or exclamation mark
I'm trying to insert an HTML tag after the first sentence in each paragraph of a given document.
The code I came up with ( I am not a programmer) is working.
The $insert_pos is the position where a ...
2
votes
2
answers
1k
views
Building a WordPress search query that ignores punctuation?
I've set up a search query like this:
<?php
$s = get_search_query();
$args = array(
'post_type' => array('post'),
'posts_per_page' => '10',
'order' => 'DESC',
'orderby' =&...
-2
votes
1
answer
2k
views
Detect if a string contains any punctuation or accentued characters in PHP
I've been looking on internet without finding answers to my problem.
I want that the user enter a login to create his account, but I need to check if there is any punctuation or accentued characters ...
0
votes
1
answer
66
views
qTranslate-X formatting not uniform across languages (apostrophe vs right single quote)
English and Dutch languages enabled. I have my formatting.php set up to differentiate apostrophes (straight, ') and right single quotes (curly, ’):
$apos = _x( ''', 'apostrophe' );
$...
1
vote
1
answer
456
views
Attempt at finding period in string with strpos not working
I'm trying to find if there's a period in a string with strpos, but for some reason it prints out "There's no period." every time I run the code. I'm not sure what I did wrong.
$text = "Hello.";
if (...
1
vote
2
answers
122
views
Limit text to a certain number of chars, but stop when a period is found within the final 20 chars
So, I have this function to produce an excerpt from large texts.
function excerpt( $string, $max_chars = 160, $more = '...' ) {
if ( strlen( $string ) > $max_chars ) {
$cut = substr( ...
0
votes
1
answer
748
views
How to keep DOT(.) in transliterator_transliterate while removing other punctuations?
My below function sanitize uploaded files:
public static function slugify($string) {
$string = transliterator_transliterate("Any-Latin; NFD; [:Nonspacing Mark:] Remove; NFC; [:Punctuation:] ...
1
vote
2
answers
253
views
Normalize sentence punctuation in php?
I have lots of input sentences I want to normalize.
What they have in common is that they don't have spaces after commas and periods.
Oval,delicate cupcakes.Very tasty.Enjoy.
What is a quickest way ...
0
votes
2
answers
150
views
PHP Regexp - if custom punctuation symbols are side-by-side, then regex doesn't match
my regexp
/^[\p{L}\p{N}][\p{L}\p{N} \.,;:\?!-“”‘’"']+$/u
aim of regexp
allow utf-8 characters, numbers, spaces AND custom punctuation to verify article title
these inputs below don't match but I ...