B
B
Bogdan Ostapchuk2016-04-26 17:59:24
PHP
Bogdan Ostapchuk, 2016-04-26 17:59:24

How to write a regexp to search for a sequence of numbers without considering the character between them?

The essence of the question is as follows - you need to find a sequence of 7 or more numbers in the text, between which there may be spaces and other characters. Wrote such an expression - /((\d.*){7,})/im. But, unfortunately, there is a behavior that is incomprehensible to me - for some reason it works on such text -

Assignment structure
1. Introduction (200 words)
Brief description of your chosen company
2. Theory section (300 words)
Explain the theories and frameworks on cultures, institutions, internal organization, foreign entry strategy and CSR that you are going to use in your analysis .

Matches the following:
array (size=3)
  0 => string '1. Introduction (200 words) Brief description of your chosen company 2. Theory section (300 words) Explain the theories and frameworks on cultures, institutions, internal organisation, foreign entry strategy and CSR that you are going to use in your analysis. ' (length=260)
  1 => string '1. Introduction (200 words) Brief description of your chosen company 2. Theory section (300 words) Explain the theories and frameworks on cultures, institutions, internal organisation, foreign entry strategy and CSR that you are going to use in your analysis. ' (length=260)
  2 => string '0 words) Explain the theories and frameworks on cultures, institutions, internal organisation, foreign entry strategy and CSR that you are going to use in your analysis. ' (length=170)

Please tell me how to correct the existing solution, or write a new one. Thanks
PS. Thanks for the hints, didn't specify the expected result. Should work on records like - 45-( 56) 34-8, and other similar combinations

Answer the question

In order to leave comments, you need to log in

3 answer(s)
B
Bogdan Ostapchuk, 2016-04-27
@Bogdan92

Thank you all for your help, tips and comments.
In the end, I settled on this option -/([+() ]*(\d[+()\- ]*){7,})/m

D
DarkMatter, 2016-04-26
@darkmatter

Since the task has been set now, here is your sequence of numbers regexr.com/3da44 ))

A
Askar Fuzaylov, 2015-05-11
@IPD2

<?php $this->widget('bootstrap.widgets.TbGridView',array(
'id'=>'ref-mahala-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
'id',
array(
            'name' => 'district_id',
            'value' => '$data->region->name',
        ),
'name_ru',
'name_uz',
'name_en',
'address_ru',
array(
  'class'=>'bootstrap.widgets.TbButtonColumn',
),
),
)); ?>

www.yiiframework.com/doc/api/1.1/CDataColumn

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question