jquery RegularExpression

Abdullah Almesbahi

I want to replace 0 in widget-cadr_testimonials[1][slides][0][slide_title]

var patt1=/\d+/g; // this is returning the two found integers 1,0 and I need only 0 and want to replace it

var str="widget-cadr_testimonials[1][slides][0][slide_title]";
var patt1=/\d+/g;
document.write(str.match(patt1));
SmokeyPHP
str.replace(/\d+([^\d]+)$/,'x$1');//Where 'x' is your replacement

To just get the matched number you can debug:

str.match(/(\d+)[^\d]+$/)[1]

Or if you want to be more specific about the text either side:

str.replace(/\[\d+\](\[slide_title)/,'[x]$1')

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

how to clean a [RegularExpression] MVC message with jQuery?

From Dev

RegularExpression matchesInString issue in Swift

From Dev

Regularexpression to get the .com

From Dev

RegularExpression Attribute Not Working as Expected

From Dev

PHP plus RegularExpression parse

From Dev

RegularExpression data annotation

From Dev

RegularExpression Attribute Not Working as Expected

From Dev

RegularExpression matchesInString issue in Swift

From Dev

Get number via RegularExpression

From Dev

DataAnnotations RegularExpression - disallow URLs

From Dev

DataAnnotations validation adding `@` to RegularExpression

From Dev

RegularExpression data annotation

From Dev

Getting error while putting RegularExpression

From Dev

Validating models using RegularExpression annotation

From Dev

MVC 5 RegularExpression Phone Number

From Dev

Replace regularexpression-string in metadataattribute

From Dev

Date RegularExpression does NOT work on FireFox

From Dev

When linking against poco, get RegularExpression error

From Dev

The RegularExpression data annotation is not being recognized by the Validator

From Dev

C# RegularExpression Model Validation Length

From Dev

When linking against poco, get RegularExpression error

From Dev

What is regularexpression to allow specific characters in php

From Dev

What does ' sign mean in RegularExpression attribute?

From Dev

Using RegularExpression for Getting Parts of IP and Port Numbers

From Dev

MVC Validation make RegularExpression numeric only on string field

From Dev

How do I validate a TextBox with a RegularExpression based on a DropDownList Selection?

From Dev

RegularExpression validation fails at ModelState.IsValid when input is 0.00

From Dev

UIHint and RegularExpression annotations are not working together MVC4

From Dev

RegularExpression DataAnnotation to validate string EndsWith particular domain name

Related Related

  1. 1

    how to clean a [RegularExpression] MVC message with jQuery?

  2. 2

    RegularExpression matchesInString issue in Swift

  3. 3

    Regularexpression to get the .com

  4. 4

    RegularExpression Attribute Not Working as Expected

  5. 5

    PHP plus RegularExpression parse

  6. 6

    RegularExpression data annotation

  7. 7

    RegularExpression Attribute Not Working as Expected

  8. 8

    RegularExpression matchesInString issue in Swift

  9. 9

    Get number via RegularExpression

  10. 10

    DataAnnotations RegularExpression - disallow URLs

  11. 11

    DataAnnotations validation adding `@` to RegularExpression

  12. 12

    RegularExpression data annotation

  13. 13

    Getting error while putting RegularExpression

  14. 14

    Validating models using RegularExpression annotation

  15. 15

    MVC 5 RegularExpression Phone Number

  16. 16

    Replace regularexpression-string in metadataattribute

  17. 17

    Date RegularExpression does NOT work on FireFox

  18. 18

    When linking against poco, get RegularExpression error

  19. 19

    The RegularExpression data annotation is not being recognized by the Validator

  20. 20

    C# RegularExpression Model Validation Length

  21. 21

    When linking against poco, get RegularExpression error

  22. 22

    What is regularexpression to allow specific characters in php

  23. 23

    What does ' sign mean in RegularExpression attribute?

  24. 24

    Using RegularExpression for Getting Parts of IP and Port Numbers

  25. 25

    MVC Validation make RegularExpression numeric only on string field

  26. 26

    How do I validate a TextBox with a RegularExpression based on a DropDownList Selection?

  27. 27

    RegularExpression validation fails at ModelState.IsValid when input is 0.00

  28. 28

    UIHint and RegularExpression annotations are not working together MVC4

  29. 29

    RegularExpression DataAnnotation to validate string EndsWith particular domain name

HotTag

Archive